Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Raspberry Pi 4 DMA range fix



That patch isn’t quite right because _DMA restrictions apply only to children of the bus that it appears on (ACPI 6.4 section 6.2.4). So yeah, we want _DMA to apply to PCI devices that are a child of the PCI0 device here, but this isn’t the right way to go about it.

I think we need to special case this for acpipchb because we don’t really have a clean way of expressing the relationship between a PCI device and firmware tables. Probably acpi_pci_md_attach_hook is the right place to do this, but if it’s easier to do in acpipchb_attach, I won’t object.

The device ID check is probably not worth doing, let's drop that part.



> On May 3, 2022, at 11:46 AM, Tobias Nygren <tnn%NetBSD.org@localhost> wrote:
> 
> Hi!
> 
> I tracked down why NVMe doesn't work on the 8 gig RPi4.
> The UEFI firmware has this ACPI table excerpt:
> 
>  Scope (\_SB)
>  {
>    Device (PCI0)
>    {
>      Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */)
>      ...
>      Name (_DMA, ResourceTemplate ()
>      {
>        QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
>          0x0000000000000000, // Granularity
>          0x0000000000000000, // Range Minimum
>          0x00000000BFFFFFFF, // Range Maximum
> 
> Note here that _DMA is on the actual device node PCI0.
> But in sys/arch/arm/acpi/acpi_machdep.c we only check for _DMA on the
> parent device node. Also the _HID doesn't match module_hid, ACPI0004.
> This results in the default DMA range being used and the device uses
> nonreachable memory.
> 
> I think the ACPI machdep code should be changed as below. Is this ok?
> With this I can use NVMe with the full 8 GiB of RAM enabled.
> 
> --- sys/arch/arm/acpi/acpi_machdep.c	8 Aug 2021 10:28:26 -0000	1.25
> +++ sys/arch/arm/acpi/acpi_machdep.c	3 May 2022 14:36:59 -0000
> @@ -499,6 +499,9 @@ arm_acpi_dma_module(struct acpi_softc *s
> 	ACPI_HANDLE tmp;
> 	ACPI_STATUS rv;
> 
> +	rv = AcpiGetHandle(ad->ad_handle, "_DMA", &tmp);
> +	if (ACPI_SUCCESS(rv))
> +		return ad->ad_handle;
> 	/*
> 	 * Search up the tree for a module device with a _DMA method.
> 	 */
> @@ -525,7 +528,7 @@ arm_acpi_dma_init_ranges(struct acpi_sof
> 	ACPI_STATUS rv;
> 	int n;
> 
> -	module = arm_acpi_dma_module(sc, ad->ad_parent);
> +	module = arm_acpi_dma_module(sc, ad);
> 	if (module == NULL) {
> default_tag:
> 		/* No translation required */



Home | Main Index | Thread Index | Old Index