LuK1337 changed the topic of #titandev to: Loliés! | *yiff* | https://libera.irclog.whitequark.org/titandev
Senkaku has joined #titandev
Senkaku has quit [Remote host closed the connection]
<LuK1337> luca020400: is op project info exposed to bootloader somehow?
<luca020400> hmm op project info'
<luca020400> ?
<LuK1337> drivers/soc/qcom/project_info.c
<LuK1337> include/linux/project_info.h
<LuK1337> (((oneplus)))
<LuK1337> my kernel tree boots on R FW if i replace project_info struct alone
<LuK1337> so i feel like it's exposed to BL somehow?
<luca020400> hmm I feel like you simply have to handle the 2 different project_info structs in kernel?
<luca020400> no way thr bl reads it
<luca020400> smem_find is likely bailing on you
<LuK1337> i don't get it
<LuK1337> how replacing the struct itself
<LuK1337> is enough to make it boot
<luca020400> because the kernel driver shits itself?
<LuK1337> how?
<luca020400> it can even make the bl crash for the matter
<LuK1337> items are just reordered
<LuK1337> plus there's more space...
<LuK1337> maybe i should just try booting it on Q bl
<LuK1337> ...
<LuK1337> instead of trying to understand how to make it bl version specific
<luca020400> maybe it doesn't fill the struct nicely...
<luca020400> and the memory gets corrupted?
<LuK1337> yeah, new struct breaks Q
<luca020400> I would expect only a bigger struct to break it
<LuK1337> smaller breaks R
<LuK1337> bigger breaks Q
<luca020400> but if it attempts to read more data than what is exposed it might read some non-readable pages
<luca020400> and the hypervisor sigkill it
<luca020400> then it must be right sized
<luca020400> because the data might be not contiguos
<luca020400> and different bits of the struct are scattered in different pages
<luca020400> so if it doesn't match it blows
<LuK1337> tbh i'd like to just convert to "v2" in that one part of code
<LuK1337> that'd want the newer struct
<LuK1337> if R FW
<luca020400> I'd do the same v2
<luca020400> but can you differentiate bl version?
<LuK1337> cmdline
<LuK1337> R firmware cmdline is a lot longer
<luca020400> sucks but will do
<LuK1337> androidboot.platform_name=SDM845
<LuK1337> old FW doesn't have that
<LuK1337> so i can really just do that
<LuK1337> but the problem is: where do i need to return newer struct
<LuK1337> and where old one is still aight
<LuK1337> because i doubt that old struct is unusable everywhere
<LuK1337> there must be that one thing that strictly wants new one
<luca020400> given how it crashes I'd say all different structs must be versioned...
<LuK1337> project_info_desc = smem_find(SMEM_PROJECT_INFO,
<LuK1337> sizeof(struct project_info),
<LuK1337> 0,
<LuK1337> SMEM_ANY_HOST_FLAG);
<LuK1337> ok
<LuK1337> i believe it's that?
<LuK1337> oh so whole project info is from smem
<LuK1337> and my struct needs to be aligned with it
<LuK1337> yikes
<LuK1337> ok so i'm going to add v2 struct
<LuK1337> then duplicate driver
<LuK1337> and add probe() that'd load newer one for FW=R
<LuK1337> does that seem legit?
<luca020400> can't you do in driver versioning?
<LuK1337> kinda trying now
<LuK1337> since symbols are duplicated ;-;
<luca020400> union struct?
<LuK1337> struct items aren't in same order
<LuK1337> tbh i know what to do now
<LuK1337> project_info is never written to
<LuK1337> so i can just replace ->member
<LuK1337> with + offsetof(project_info_v2, project_name)
<LuK1337> or offsetof v1 if needed
<LuK1337> ugly? yeah, who cares.
<LuK1337> hmm it is written to
<LuK1337> ehh
<LuK1337> and there are a lot uses of it
<luca020400> this kinda sucks
<LuK1337> #define GET_PROJECT_INFO_STR(member) (project_info_desc + (project_info_desc_is_v2 ? offsetof(project_info_v2, member) : offsetof(project_info, member)))
<LuK1337> #define GET_PROJECT_INFO_UINT32(member) (*(uint32_t*)(project_info_desc + (project_info_desc_is_v2 ? offsetof(project_info_v2, member) : offsetof(project_info, member))))
<LuK1337> #define SET_PROJECT_INFO_UINT32(member, value) *(uint32_t*)(project_info_desc + (project_info_desc_is_v2 ? offsetof(project_info_v2, member) : offsetof(project_info, member))) = value;
<luca020400> Will do, I'd prefer an union tho...
<LuK1337> it kinda works
<LuK1337> except it crashdumps after a while
<LuK1337> xd
<luca020400> good enough
<LuK1337> yeah but it does that on both devices...
<LuK1337> what could i have done wrong here?
<LuK1337> hm
<LuK1337> maybe uint32_t -> uint32
<luca020400> not sure?
<LuK1337> tho if you have a better way how to fix the issue as a whole
<LuK1337> just drop me a diff
<LuK1337> cause idk how i'd do that with an union...
<LuK1337> i pretty much never used union
<luca020400> you could hack it and get v2, and manually build v1 in case
<luca020400> this will avoid all this offset mess
<LuK1337> well i get v1 / v2 from smem
<luca020400> with union you'd make a struct with version: int 1, union { v1, v2 }
<luca020400> and then everytime check of version and use proper member
<luca020400> verbose
<luca020400> but \o/
<luca020400> well then if you get v from it just read up to version
<luca020400> and then read the whole proper struct?
<luca020400> ( only works if version is in same place )
<LuK1337> members aren't in same places
<luca020400> yikes
<LuK1337> uh
<LuK1337> i got rid of offsetof
<LuK1337> but it's still crashing
<LuK1337> wtf
<LuK1337> oh
<LuK1337> still crashes but at least code is cleaner
<LuK1337> i think boot_command_line ptr sucks ass
<LuK1337> trying saved_command_line
<LuK1337> wow
<LuK1337> it works
<LuK1337> luca020400: how do you like my current impl?
<luca020400> that's an union, without an union
<LuK1337> i'm happy that it works cuz now i can try to make userbase work on Q+R vendor
<LuK1337> and drop Q on next version
<LuK1337> ehhh why oneplus had to change memory map
<LuK1337> place your bets: will new memory map break audio on old fw
<luca020400> why
<luca020400> but I've seen it already...
<LuK1337> tbh idk if i need this new map
<LuK1337> i thought i did
<LuK1337> cause after copying techpack, char and dts
<LuK1337> my audio started working
<LuK1337> so i thought it was cdsp mem etc map
<LuK1337> but that wasn't it?
<LuK1337> maybe it was just dts...
<LuK1337> or more like
<LuK1337> new R kernel uses different qcom,board-id
<LuK1337> so there's a chance that BL cares bit more
<LuK1337> and thus fixes my audio and touchscreen
<LuK1337> if i have correct one
<LuK1337> - qcom,board-id = <8 0 17819 24>;
<LuK1337> + qcom,board-id = <8 0>;
<LuK1337> + oem,project-id = <17819>;
<LuK1337> + oem,hw-id = <24>;
<LuK1337> like so
<luca020400> oh
<luca020400> you're lucky it even works
<LuK1337> perhaps
<LuK1337> do you think bl uses oem,project-id?
<LuK1337> and hw-id?
<LuK1337> or just board-id?
<luca020400> board-id
<luca020400> and then uses caf defaults for memery
<LuK1337> you're ruining my dreams
<LuK1337> i thought i could keep old board-id
<luca020400> sorry
<LuK1337> can i have multiple board ids?
<luca020400> nop
<LuK1337> ok but how does it choose overlay then
<LuK1337> if oem,project-id, oem,hw-id are unused
<LuK1337> and there are multiple overlays
<LuK1337> using same msm-id, board-id?
<luca020400> wish I knew
<LuK1337> what if i actually can keep old board-id
<luca020400> try?
<luca020400> maybe there's a fallback
<LuK1337> i'm hoping that i can keep old board-id + add oem,*
<LuK1337> and thus make it work on both old+new fw
<LuK1337> i'm hoping that it only checks the first 2 sections
<LuK1337> in BL
<luca020400> I don't know how the stuff is saved in dts
<luca020400> but it depends on endian if it works or not
<LuK1337> it works
<LuK1337> my ts is no longer miscalibrated
<LuK1337> and audio works
<luca020400> you're lucky
<luca020400> ah ok qcom,board-id layout is hardcoded to be that way
<luca020400> why stereo dies now
<luca020400> has been a few days
<luca020400> bt audio plays only on left randomly
<LuK1337> i wonder if i did something wrong
<LuK1337> cuz i just flashed my 6t and it's stuck on bl warning
<LuK1337> and this stupid phone is really *stuck*
<LuK1337> can't reboot it lol
<luca020400> enough time will trigger pmic
<LuK1337> ok rebooted it
<LuK1337> recovery booted
<luca020400> also pipewire added sbc hq
<LuK1337> but no OS for some reason
<luca020400> it's nice
<luca020400> aac latency kills me
<LuK1337> yay op6 still boots
<LuK1337> 29 18:59:46.357 3844 3844 E AndroidRuntime: Process: com.android.nfc, PID: 3844
<LuK1337> 08-29 18:59:46.357 3844 3844 E AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/os/OPDiagnoseManager;
<LuK1337> ofc they had to add another junk
<LuK1337> it's not even used lmao
<LuK1337> they just get the class and do nothing with it
<LuK1337> oh it's used in other apk
<LuK1337> need to implement 1 stub
<LuK1337> also i'll break few things for people on old fw
<LuK1337> fuckers can just flash new fw
<LuK1337> idc about keeping dashd, ant+ working
<LuK1337> for Q
<luca020400> as long as basics work
<LuK1337> yeah fuck legacy users
<LuK1337> i just want bare minimum
<LuK1337> so that reddit isn't spammed with "18.1 past X date bricked my phone"
<LuK1337> rate my commit msg
<luca020400> 9.7/10