Re: panic in sysmon_envsys_unregister
On 2022/09/14 19:01, Edgar Fuß wrote: >> I need to build a new install image (since I have no discs). > I applied your fix to -8 and the panic disappeared. > Thanks for the quick fix. Maybe it should be pulled up? I'll send pullup requests. -- --- SAITOH Masanobu (msai...@execsw.org msai...@netbsd.org)
Re: Problems with implementing EFI runtime support for x86
> Date: Tue, 13 Sep 2022 16:16:19 +0200 > From: Paweł Cichowski > > I am currently trying to implement efi runtime for x86-based ports, > and I may need some guidance in terms of some issues that have > emerged. My implementations are available here: > https://github.com/3mdeb/NetBSD-src/pull/2/files and most notable > changes are present in x86/x86/efi.c. Please excuse any bad > practices and lack of knowledge on the subject, as I am only > starting my journey of kernel development. Hi Paweł! Neat! The first problem I see in efi_map_runtime is that you take the VA from the EFI memory descriptor, and then throw it away and allocate an unrelated one in the kernel's private area (the kernel map) with uvm_km_alloc. Similar with efi_map_runtime2 but with _x86_memio_map instead of uvm_km_alloc. So the virtual addresses that the EFI runtime services are set up to use (which may be just the physical addresses, for physical addressing) aren't mapped to anything when you enter the EFI code, which means it'll try to reach into oblivion when you do that, triggering a uvm fault panic. Unfortunately there are some very tricky issues in here with handling pmaps. So it'll take a bit more to get it working. There are also some smaller issues like using x86_disable_intr/x86_enable_intr (might cause interrupts to become enabled when they weren't before) instead of x86_read_psl/x86_disable_intr/x86_write_psl (restores whether they were enabled before), although disabling CPU interrupts isn't necessary anyway as far as I know. As it happens, last month I drafted an attempt at EFI runtime services on x86 myself. I didn't commit it then because the functions all kept failing with EFI_INVALID_PARAMETER and I couldn't figure out why -- but it turns out the critical detail I had missed was the ms_abi calling convention for the EFI runtime services. So I'm planning to commit my version soon. But you made a valiant effort -- feel free to ask again if you have any more questions about NetBSD kernel development! Would you like to give this patch a whirl before I commit it? >From 95e6c735abb86b826370862aba8c39fb9bc18fbb Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 14 Sep 2022 10:25:01 + Subject: [PATCH 1/2] efi(9): Set correct calling convention for EFI runtime services. No functional change intended -- this only affects x86, which currently doesn't support EFI runtime services. --- sys/dev/efi/efi.h | 30 +++--- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/dev/efi/efi.h b/sys/dev/efi/efi.h index 86feeb6e89a6..683741253c12 100644 --- a/sys/dev/efi/efi.h +++ b/sys/dev/efi/efi.h @@ -38,6 +38,12 @@ * https://uefi.org/sites/default/files/resources/UEFI_Spec_2_9_2021_03_18.pdf */ +#if defined(__i386__) || defined(__x86_64__) +#defineEFIAPI __attribute__((__ms_abi__)) +#else +#defineEFIAPI /* empty */ +#endif + enum efi_reset { EFI_RESET_COLD, EFI_RESET_WARM, @@ -121,22 +127,24 @@ struct efi_tblhdr { struct efi_rt { struct efi_tblhdr rt_hdr; - efi_status (*rt_gettime)(struct efi_tm *, struct efi_tmcap *); - efi_status (*rt_settime)(struct efi_tm *); + efi_status (*rt_gettime)(struct efi_tm *, struct efi_tmcap *) + EFIAPI; + efi_status (*rt_settime)(struct efi_tm *) EFIAPI; efi_status (*rt_getwaketime)(uint8_t *, uint8_t *, - struct efi_tm *); - efi_status (*rt_setwaketime)(uint8_t, struct efi_tm *); + struct efi_tm *) EFIAPI; + efi_status (*rt_setwaketime)(uint8_t, struct efi_tm *) EFIAPI; efi_status (*rt_setvirtual)(u_long, u_long, uint32_t, - struct efi_md *); - efi_status (*rt_cvtptr)(u_long, void **); + struct efi_md *) EFIAPI; + efi_status (*rt_cvtptr)(u_long, void **) EFIAPI; efi_status (*rt_getvar)(efi_char *, struct uuid *, uint32_t *, - u_long *, void *); - efi_status (*rt_scanvar)(u_long *, efi_char *, struct uuid *); + u_long *, void *) EFIAPI; + efi_status (*rt_scanvar)(u_long *, efi_char *, struct uuid *) + EFIAPI; efi_status (*rt_setvar)(efi_char *, struct uuid *, uint32_t, - u_long, void *); - efi_status (*rt_gethicnt)(uint32_t *); + u_long, void *) EFIAPI; + efi_status (*rt_gethicnt)(uint32_t *) EFIAPI; efi_status (*rt_reset)(enum efi_reset, efi_status, u_long, - efi_char *); + efi_char *) EFIAPI; }; struct efi_systbl { >From 6faf7aa91fd309b4379b018aaedb0320824b4243 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 19 Aug 2022 19:49:48 + Subject: [PATCH 2/2] x86: Support EFI runtime services. This creates a special pmap, efi_runtime_pmap, which
Re: debugging a kernel that doesn't start
On Mon, Sep 12, 2022 at 10:56:46PM +0200, Edgar Fuß wrote: > Probably stupid question: I can switch the machine to UEFI. Is it easier > to debug things from there that from a BIOS boot? My experience on a mac is that it helps a lot. You can printf() during early boot, until you call UEFI's ExitBootServices. Removing that call may cause a crash at some time, but it will let you printf() a bit further. -- Emmanuel Dreyfus m...@netbsd.org
Re: Dell PERC H330: no disks, no volumes
e...@math.uni-bonn.de (Edgar =?iso-8859-1?B?RnXf?=) writes: >> I don't remember the details (and it depends on the controller version), >> but you need to have physical disks assigned to one (or more) RAID volume, >> and then the RAID volume has to be exported as one (or more) virtual disks. >But what if I want to pass the bare discs to NetBSD for a RAIDframe use? If possible configure the disk as JBOD or as a 1 disk RAID-0 volume.
Re: Dell PERC H330: no disks, no volumes
> Yes, in the controller setup you can create "Non-RAID Disks" (aka > JBOD) or "Virtual Disks" (aka RAID volumes) Where exactly are those Non-RAID Disks hiodden? > In theory you could use bioctl to create and manage volumes, but the > driver doesn't implement it. Ah, interesting. That was the way I was trying to use.
Re: Dell PERC H330: no disks, no volumes
> I don't remember the details (and it depends on the controller version), > but you need to have physical disks assigned to one (or more) RAID volume, > and then the RAID volume has to be exported as one (or more) virtual disks. But what if I want to pass the bare discs to NetBSD for a RAIDframe use?
Re: Dell PERC H330: no disks, no volumes
e...@math.uni-bonn.de (Edgar =?iso-8859-1?B?RnXf?=) writes: >> -> This is attaching a H330 (RAID version) and it gets the mfii driver. >> mfii0 at pci1 dev 0 function 0: "PERC H330 Mini", firmware 25.5.9.0001 >OK, remains the question why I don't see any discs in bioctl. > 0 Non-RAID Disk(s) found on the host adapter. > 0 Non-RAID Disk(s) handled by BIOS > 0 Virtual Disk(s) found on the host adapter. > 0 Virtual Disk(s) handled by BIOS This means you do have a RAID controller (so much for marketing) but that you have haven't configured any RAID volumes. >Is this normal? The only place I see discs being recognized is in the BIOS >setup's controller setup. Yes, in the controller setup you can create "Non-RAID Disks" (aka JBOD) or "Virtual Disks" (aka RAID volumes) and at least the latter could then be visible to bootloader (BIOS) and kernel. Disks that aren't configured as either aren't visible. In theory you could use bioctl to create and manage volumes, but the driver doesn't implement it.
Re: Dell PERC H330: no disks, no volumes
On Wed, Sep 14, 2022 at 11:07:23AM +0200, Edgar Fuß wrote: > Oh, I wasn't aware the H330 and HBA330 are different devices! > > > There is a PERC H330 and a PERC HBA330 and the Dell PERC9 user manual > > (includes the H330) says you can boot it in HBA mode. Not sure if > > that means that you can chose the firmware. > Oh well. So the HBA330 is a PowerEdge RAID Controller that isn't a RAID > controller? Thanks, Dell marketing! > > > -> This is attaching a H330 (RAID version) and it gets the mfii driver. > > mfii0 at pci1 dev 0 function 0: "PERC H330 Mini", firmware 25.5.9.0001 > OK, remains the question why I don't see any discs in bioctl. > > On startup, the machine utters the following: > > PowerEdge Expandable RAID Controller BIOS > Copyright(c) 2016 Avago Technologies > Press to Run Configuration Utility > HA -0 (Bus 1 Dev 0) PERC H330 Mini > FW package: 25.5.0.0001 > > > 0 Non-RAID Disk(s) found on the host adapter. > 0 Non-RAID Disk(s) handled by BIOS > > 0 Virtual Disk(s) found on the host adapter. > > 0 Virtual Disk(s) handled by BIOS > > Is this normal? The only place I see discs being recognized is in the BIOS > setup's controller setup. It's not normal, and this explains why NetBSD doens't see any disks. I don't remember the details (and it depends on the controller version), but you need to have physical disks assigned to one (or more) RAID volume, and then the RAID volume has to be exported as one (or more) virtual disks. -- Manuel Bouyer NetBSD: 26 ans d'experience feront toujours la difference --
Re: panic in sysmon_envsys_unregister
e...@math.uni-bonn.de (Edgar =?iso-8859-1?B?RnXf?=) writes: >The other question is why the register call fails. >According to the BIOS setup, the controller has no sensors. Could that be >the problem? The bio framework uses sensors so that you can watch for failed volumes. No volumes means no sensors and the register code fails.
Re: panic in sysmon_envsys_unregister
> I need to build a new install image (since I have no discs). I applied your fix to -8 and the panic disappeared. Thanks for the quick fix. Maybe it should be pulled up?
Re: Dell PERC H330: no disks, no volumes
Oh, I wasn't aware the H330 and HBA330 are different devices! > There is a PERC H330 and a PERC HBA330 and the Dell PERC9 user manual > (includes the H330) says you can boot it in HBA mode. Not sure if > that means that you can chose the firmware. Oh well. So the HBA330 is a PowerEdge RAID Controller that isn't a RAID controller? Thanks, Dell marketing! > -> This is attaching a H330 (RAID version) and it gets the mfii driver. > mfii0 at pci1 dev 0 function 0: "PERC H330 Mini", firmware 25.5.9.0001 OK, remains the question why I don't see any discs in bioctl. On startup, the machine utters the following: PowerEdge Expandable RAID Controller BIOS Copyright(c) 2016 Avago Technologies Press to Run Configuration Utility HA -0 (Bus 1 Dev 0) PERC H330 Mini FW package: 25.5.0.0001 0 Non-RAID Disk(s) found on the host adapter. 0 Non-RAID Disk(s) handled by BIOS 0 Virtual Disk(s) found on the host adapter. 0 Virtual Disk(s) handled by BIOS Is this normal? The only place I see discs being recognized is in the BIOS setup's controller setup.
Re: panic in sysmon_envsys_unregister
> This should be fixed by mfii.c rev. 1.26. Please update it and retry. Thanks. I need to build a new install image (since I have no discs). The other question is why the register call fails. According to the BIOS setup, the controller has no sensors. Could that be the problem?