mbox series

[RFC,0/4] ACPI/IORT: Support for IORT RMR node

Message ID 20201027112646.44680-1-shameerali.kolothum.thodi@huawei.com
Headers show
Series ACPI/IORT: Support for IORT RMR node | expand

Message

Shameerali Kolothum Thodi Oct. 27, 2020, 11:26 a.m. UTC
The series adds support to IORT RMR nodes specified in IORT
Revision E -ARM DEN 0049E[0]. RMR nodes are used to describe memory
ranges that are used by endpoints and require a unity mapping
in SMMU.

We have faced issues with 3408iMR RAID controller cards which
fail to boot when SMMU is enabled. This is because these controllers
make use of host memory for various caching related purposes and when
SMMU is enabled the iMR firmware fails to access these memory regions
as there is no mapping for them. IORT RMR provides a way for UEFI to
describe and report these memory regions so that the kernel can make
a unity mapping for these in SMMU.

RFC because, Patch #1 is to update the actbl2.h and should be done
through acpica update. I have send out a pull request[1] for that.

Tests:

With a UEFI, that reports the RMR for the dev,
....
[16F0h 5872   1]                         Type : 06
[16F1h 5873   2]                       Length : 007C
[16F3h 5875   1]                     Revision : 00
[1038h 0056   2]                     Reserved : 00000000
[1038h 0056   2]                   Identifier : 00000000
[16F8h 5880   4]                Mapping Count : 00000001
[16FCh 5884   4]               Mapping Offset : 00000040

[1700h 5888   4]    Number of RMR Descriptors : 00000002
[1704h 5892   4]        RMR Descriptor Offset : 00000018

[1708h 5896   8]          Base Address of RMR : 0000E6400000
[1710h 5904   8]                Length of RMR : 000000100000
[1718h 5912   4]                     Reserved : 00000000

[171Ch 5916   8]          Base Address of RMR : 0000000027B00000
[1724h 5924   8]                Length of RMR : 0000000000C00000
[172Ch 5932   4]                     Reserved : 00000000

[1730h 5936   4]                   Input base : 00000000
[1734h 5940   4]                     ID Count : 00000001
[1738h 5944   4]                  Output Base : 00000003
[173Ch 5948   4]             Output Reference : 00000064
[1740h 5952   4]        Flags (decoded below) : 00000001
                               Single Mapping : 1
...

Without the series the RAID controller initilization fails as
below,

...
[   12.631117] megaraid_sas 0000:03:00.0: FW supports sync cache        : Yes   
[   12.637360] megaraid_sas 0000:03:00.0: megasas_disable_intr_fusion is called outbound_intr_mask:0x40000009                                                   
[   18.776377] megaraid_sas 0000:03:00.0: Init cmd return status FAILED for SCSI host 0                                                                         
[   23.019383] megaraid_sas 0000:03:00.0: Waiting for FW to come to ready state 
[  106.684281] megaraid_sas 0000:03:00.0: FW in FAULT state, Fault code:0x10000 subcode:0x0 func:megasas_transition_to_ready                                    
[  106.695186] megaraid_sas 0000:03:00.0: System Register set:                  
[  106.889787] megaraid_sas 0000:03:00.0: Failed to transition controller to ready for scsi0.                                                                   
[  106.910475] megaraid_sas 0000:03:00.0: Failed from megasas_init_fw 6407      
estuary:/$

With the series, now the kernel has direct mapping for the dev as
below,

estuary:/$ cat /sys/kernel/iommu_groups/0/reserved_regions                      
0x0000000008000000 0x00000000080fffff msi                                       
0x0000000027b00000 0x00000000286fffff direct                                    
0x00000000e6400000 0x00000000e64fffff direct                                    
estuary:/$

....
[   12.254318] megaraid_sas 0000:03:00.0: megasas_disable_intr_fusion is called outbound_intr_mask:0x40000009                                                   
[   12.739089] megaraid_sas 0000:03:00.0: FW provided supportMaxExtLDs: 0      max_lds: 32                                                                      
[   12.746628] megaraid_sas 0000:03:00.0: controller type       : iMR(0MB)      
[   12.752694] megaraid_sas 0000:03:00.0: Online Controller Reset(OCR)  : Enabled                                                                               
[   12.759798] megaraid_sas 0000:03:00.0: Secure JBOD support   : Yes           
[   12.765778] megaraid_sas 0000:03:00.0: NVMe passthru support : Yes           
[   12.771931] megaraid_sas 0000:03:00.0: FW provided TM TaskAbort/Reset timeou: 6 secs/60 secs                                                                 
[   12.780503] megaraid_sas 0000:03:00.0: JBOD sequence map support     : Yes   
[   12.787000] megaraid_sas 0000:03:00.0: PCI Lane Margining support    : No    
[   12.819179] megaraid_sas 0000:03:00.0: NVME page size        : (4096)        
[   12.825672] megaraid_sas 0000:03:00.0: megasas_enable_intr_fusion is called outbound_intr_mask:0x40000000                                                    
[   12.835199] megaraid_sas 0000:03:00.0: INIT adapter done                     
[   12.873932] megaraid_sas 0000:03:00.0: pci id                : (0x1000)/(0x0017)/(0x19e5)/(0xd213)                                                           
[   12.881644] megaraid_sas 0000:03:00.0: unevenspan support    : no            
[   12.887451] megaraid_sas 0000:03:00.0: firmware crash dump   : no            
[   12.893344] megaraid_sas 0000:03:00.0: JBOD sequence map     : enabled       

RAID controller init is now success and can detect the drives
attached as well.

Thanks,
Shameer

[0]. https://developer.arm.com/documentation/den0049/latest/
[1]. https://github.com/acpica/acpica/pull/638

Shameer Kolothum (4):
  ACPICA: IORT: Update for revision E
  ACPI/IORT: Add support for RMR node parsing
  ACPI/IORT: Add RMR memory regions reservation helper
  iommu/dma: Reserve any RMR regions associated with a dev

 drivers/acpi/arm64/iort.c | 175 +++++++++++++++++++++++++++++++++++++-
 drivers/iommu/dma-iommu.c |  12 ++-
 include/acpi/actbl2.h     |  25 ++++--
 include/linux/acpi_iort.h |   4 +
 4 files changed, 205 insertions(+), 11 deletions(-)

Comments

Steven Price Oct. 28, 2020, 4:43 p.m. UTC | #1
On 27/10/2020 11:26, Shameer Kolothum wrote:
> The series adds support to IORT RMR nodes specified in IORT
> Revision E -ARM DEN 0049E[0]. RMR nodes are used to describe memory
> ranges that are used by endpoints and require a unity mapping
> in SMMU.

Hi Shameer,

I've also been taking a look at RMR, and Sami is helping me get set up 
so that I can do some testing. We're hoping to be able to test an EFI 
framebuffer or splash screen - which has the added complication of the 
unity mapping becoming redundant if a native display driver takes over 
the display controller.

I've looked through your series and the code looks correct to me. 
Hopefully I'll be able to give it some testing soon.

Thanks,

Steve

> We have faced issues with 3408iMR RAID controller cards which
> fail to boot when SMMU is enabled. This is because these controllers
> make use of host memory for various caching related purposes and when
> SMMU is enabled the iMR firmware fails to access these memory regions
> as there is no mapping for them. IORT RMR provides a way for UEFI to
> describe and report these memory regions so that the kernel can make
> a unity mapping for these in SMMU.
> 
> RFC because, Patch #1 is to update the actbl2.h and should be done
> through acpica update. I have send out a pull request[1] for that.
> 
> Tests:
> 
> With a UEFI, that reports the RMR for the dev,
> ....
> [16F0h 5872   1]                         Type : 06
> [16F1h 5873   2]                       Length : 007C
> [16F3h 5875   1]                     Revision : 00
> [1038h 0056   2]                     Reserved : 00000000
> [1038h 0056   2]                   Identifier : 00000000
> [16F8h 5880   4]                Mapping Count : 00000001
> [16FCh 5884   4]               Mapping Offset : 00000040
> 
> [1700h 5888   4]    Number of RMR Descriptors : 00000002
> [1704h 5892   4]        RMR Descriptor Offset : 00000018
> 
> [1708h 5896   8]          Base Address of RMR : 0000E6400000
> [1710h 5904   8]                Length of RMR : 000000100000
> [1718h 5912   4]                     Reserved : 00000000
> 
> [171Ch 5916   8]          Base Address of RMR : 0000000027B00000
> [1724h 5924   8]                Length of RMR : 0000000000C00000
> [172Ch 5932   4]                     Reserved : 00000000
> 
> [1730h 5936   4]                   Input base : 00000000
> [1734h 5940   4]                     ID Count : 00000001
> [1738h 5944   4]                  Output Base : 00000003
> [173Ch 5948   4]             Output Reference : 00000064
> [1740h 5952   4]        Flags (decoded below) : 00000001
>                                 Single Mapping : 1
> ...
> 
> Without the series the RAID controller initilization fails as
> below,
> 
> ...
> [   12.631117] megaraid_sas 0000:03:00.0: FW supports sync cache        : Yes
> [   12.637360] megaraid_sas 0000:03:00.0: megasas_disable_intr_fusion is called outbound_intr_mask:0x40000009
> [   18.776377] megaraid_sas 0000:03:00.0: Init cmd return status FAILED for SCSI host 0
> [   23.019383] megaraid_sas 0000:03:00.0: Waiting for FW to come to ready state
> [  106.684281] megaraid_sas 0000:03:00.0: FW in FAULT state, Fault code:0x10000 subcode:0x0 func:megasas_transition_to_ready
> [  106.695186] megaraid_sas 0000:03:00.0: System Register set:
> [  106.889787] megaraid_sas 0000:03:00.0: Failed to transition controller to ready for scsi0.
> [  106.910475] megaraid_sas 0000:03:00.0: Failed from megasas_init_fw 6407
> estuary:/$
> 
> With the series, now the kernel has direct mapping for the dev as
> below,
> 
> estuary:/$ cat /sys/kernel/iommu_groups/0/reserved_regions
> 0x0000000008000000 0x00000000080fffff msi
> 0x0000000027b00000 0x00000000286fffff direct
> 0x00000000e6400000 0x00000000e64fffff direct
> estuary:/$
> 
> ....
> [   12.254318] megaraid_sas 0000:03:00.0: megasas_disable_intr_fusion is called outbound_intr_mask:0x40000009
> [   12.739089] megaraid_sas 0000:03:00.0: FW provided supportMaxExtLDs: 0      max_lds: 32
> [   12.746628] megaraid_sas 0000:03:00.0: controller type       : iMR(0MB)
> [   12.752694] megaraid_sas 0000:03:00.0: Online Controller Reset(OCR)  : Enabled
> [   12.759798] megaraid_sas 0000:03:00.0: Secure JBOD support   : Yes
> [   12.765778] megaraid_sas 0000:03:00.0: NVMe passthru support : Yes
> [   12.771931] megaraid_sas 0000:03:00.0: FW provided TM TaskAbort/Reset timeou: 6 secs/60 secs
> [   12.780503] megaraid_sas 0000:03:00.0: JBOD sequence map support     : Yes
> [   12.787000] megaraid_sas 0000:03:00.0: PCI Lane Margining support    : No
> [   12.819179] megaraid_sas 0000:03:00.0: NVME page size        : (4096)
> [   12.825672] megaraid_sas 0000:03:00.0: megasas_enable_intr_fusion is called outbound_intr_mask:0x40000000
> [   12.835199] megaraid_sas 0000:03:00.0: INIT adapter done
> [   12.873932] megaraid_sas 0000:03:00.0: pci id                : (0x1000)/(0x0017)/(0x19e5)/(0xd213)
> [   12.881644] megaraid_sas 0000:03:00.0: unevenspan support    : no
> [   12.887451] megaraid_sas 0000:03:00.0: firmware crash dump   : no
> [   12.893344] megaraid_sas 0000:03:00.0: JBOD sequence map     : enabled
> 
> RAID controller init is now success and can detect the drives
> attached as well.
> 
> Thanks,
> Shameer
> 
> [0]. https://developer.arm.com/documentation/den0049/latest/
> [1]. https://github.com/acpica/acpica/pull/638
> 
> Shameer Kolothum (4):
>    ACPICA: IORT: Update for revision E
>    ACPI/IORT: Add support for RMR node parsing
>    ACPI/IORT: Add RMR memory regions reservation helper
>    iommu/dma: Reserve any RMR regions associated with a dev
> 
>   drivers/acpi/arm64/iort.c | 175 +++++++++++++++++++++++++++++++++++++-
>   drivers/iommu/dma-iommu.c |  12 ++-
>   include/acpi/actbl2.h     |  25 ++++--
>   include/linux/acpi_iort.h |   4 +
>   4 files changed, 205 insertions(+), 11 deletions(-)
>
Shameerali Kolothum Thodi Oct. 28, 2020, 6:24 p.m. UTC | #2
Hi Steve,

> -----Original Message-----

> From: Steven Price [mailto:steven.price@arm.com]

> Sent: 28 October 2020 16:44

> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

> iommu@lists.linux-foundation.org; devel@acpica.org

> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>; robin.murphy@arm.com;

> wanghuiqiang <wanghuiqiang@huawei.com>; Sami Mujawar

> <Sami.Mujawar@arm.com>

> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

> 

> On 27/10/2020 11:26, Shameer Kolothum wrote:

> > The series adds support to IORT RMR nodes specified in IORT

> > Revision E -ARM DEN 0049E[0]. RMR nodes are used to describe memory

> > ranges that are used by endpoints and require a unity mapping

> > in SMMU.

> 

> Hi Shameer,

> 

> I've also been taking a look at RMR, and Sami is helping me get set up

> so that I can do some testing. We're hoping to be able to test an EFI

> framebuffer or splash screen - which has the added complication of the

> unity mapping becoming redundant if a native display driver takes over

> the display controller.

> 

> I've looked through your series and the code looks correct to me.


Thanks for taking a look and the details.

> Hopefully I'll be able to give it some testing soon.


Cool. Please update once you get a chance run the tests.

Thanks,
Shameer
 
> Thanks,

> 

> Steve

> 

> > We have faced issues with 3408iMR RAID controller cards which

> > fail to boot when SMMU is enabled. This is because these controllers

> > make use of host memory for various caching related purposes and when

> > SMMU is enabled the iMR firmware fails to access these memory regions

> > as there is no mapping for them. IORT RMR provides a way for UEFI to

> > describe and report these memory regions so that the kernel can make

> > a unity mapping for these in SMMU.

> >

> > RFC because, Patch #1 is to update the actbl2.h and should be done

> > through acpica update. I have send out a pull request[1] for that.

> >

> > Tests:

> >

> > With a UEFI, that reports the RMR for the dev,

> > ....

> > [16F0h 5872   1]                         Type : 06

> > [16F1h 5873   2]                       Length : 007C

> > [16F3h 5875   1]                     Revision : 00

> > [1038h 0056   2]                     Reserved : 00000000

> > [1038h 0056   2]                   Identifier : 00000000

> > [16F8h 5880   4]                Mapping Count : 00000001

> > [16FCh 5884   4]               Mapping Offset : 00000040

> >

> > [1700h 5888   4]    Number of RMR Descriptors : 00000002

> > [1704h 5892   4]        RMR Descriptor Offset : 00000018

> >

> > [1708h 5896   8]          Base Address of RMR : 0000E6400000

> > [1710h 5904   8]                Length of RMR : 000000100000

> > [1718h 5912   4]                     Reserved : 00000000

> >

> > [171Ch 5916   8]          Base Address of RMR : 0000000027B00000

> > [1724h 5924   8]                Length of RMR : 0000000000C00000

> > [172Ch 5932   4]                     Reserved : 00000000

> >

> > [1730h 5936   4]                   Input base : 00000000

> > [1734h 5940   4]                     ID Count : 00000001

> > [1738h 5944   4]                  Output Base : 00000003

> > [173Ch 5948   4]             Output Reference : 00000064

> > [1740h 5952   4]        Flags (decoded below) : 00000001

> >                                 Single Mapping : 1

> > ...

> >

> > Without the series the RAID controller initilization fails as

> > below,

> >

> > ...

> > [   12.631117] megaraid_sas 0000:03:00.0: FW supports sync

> cache        : Yes

> > [   12.637360] megaraid_sas 0000:03:00.0: megasas_disable_intr_fusion is

> called outbound_intr_mask:0x40000009

> > [   18.776377] megaraid_sas 0000:03:00.0: Init cmd return status FAILED

> for SCSI host 0

> > [   23.019383] megaraid_sas 0000:03:00.0: Waiting for FW to come to

> ready state

> > [  106.684281] megaraid_sas 0000:03:00.0: FW in FAULT state, Fault

> code:0x10000 subcode:0x0 func:megasas_transition_to_ready

> > [  106.695186] megaraid_sas 0000:03:00.0: System Register set:

> > [  106.889787] megaraid_sas 0000:03:00.0: Failed to transition controller to

> ready for scsi0.

> > [  106.910475] megaraid_sas 0000:03:00.0: Failed from megasas_init_fw

> 6407

> > estuary:/$

> >

> > With the series, now the kernel has direct mapping for the dev as

> > below,

> >

> > estuary:/$ cat /sys/kernel/iommu_groups/0/reserved_regions

> > 0x0000000008000000 0x00000000080fffff msi

> > 0x0000000027b00000 0x00000000286fffff direct

> > 0x00000000e6400000 0x00000000e64fffff direct

> > estuary:/$

> >

> > ....

> > [   12.254318] megaraid_sas 0000:03:00.0: megasas_disable_intr_fusion is

> called outbound_intr_mask:0x40000009

> > [   12.739089] megaraid_sas 0000:03:00.0: FW provided supportMaxExtLDs:

> 0      max_lds: 32

> > [   12.746628] megaraid_sas 0000:03:00.0: controller type       :

> iMR(0MB)

> > [   12.752694] megaraid_sas 0000:03:00.0: Online Controller Reset(OCR)  :

> Enabled

> > [   12.759798] megaraid_sas 0000:03:00.0: Secure JBOD support   : Yes

> > [   12.765778] megaraid_sas 0000:03:00.0: NVMe passthru support : Yes

> > [   12.771931] megaraid_sas 0000:03:00.0: FW provided TM

> TaskAbort/Reset timeou: 6 secs/60 secs

> > [   12.780503] megaraid_sas 0000:03:00.0: JBOD sequence map

> support     : Yes

> > [   12.787000] megaraid_sas 0000:03:00.0: PCI Lane Margining

> support    : No

> > [   12.819179] megaraid_sas 0000:03:00.0: NVME page size        :

> (4096)

> > [   12.825672] megaraid_sas 0000:03:00.0: megasas_enable_intr_fusion is

> called outbound_intr_mask:0x40000000

> > [   12.835199] megaraid_sas 0000:03:00.0: INIT adapter done

> > [   12.873932] megaraid_sas 0000:03:00.0: pci id                :

> (0x1000)/(0x0017)/(0x19e5)/(0xd213)

> > [   12.881644] megaraid_sas 0000:03:00.0: unevenspan support    : no

> > [   12.887451] megaraid_sas 0000:03:00.0: firmware crash dump   : no

> > [   12.893344] megaraid_sas 0000:03:00.0: JBOD sequence map     :

> enabled

> >

> > RAID controller init is now success and can detect the drives

> > attached as well.

> >

> > Thanks,

> > Shameer

> >

> > [0]. https://developer.arm.com/documentation/den0049/latest/

> > [1]. https://github.com/acpica/acpica/pull/638

> >

> > Shameer Kolothum (4):

> >    ACPICA: IORT: Update for revision E

> >    ACPI/IORT: Add support for RMR node parsing

> >    ACPI/IORT: Add RMR memory regions reservation helper

> >    iommu/dma: Reserve any RMR regions associated with a dev

> >

> >   drivers/acpi/arm64/iort.c | 175

> +++++++++++++++++++++++++++++++++++++-

> >   drivers/iommu/dma-iommu.c |  12 ++-

> >   include/acpi/actbl2.h     |  25 ++++--

> >   include/linux/acpi_iort.h |   4 +

> >   4 files changed, 205 insertions(+), 11 deletions(-)

> >
Shameerali Kolothum Thodi Oct. 28, 2020, 6:40 p.m. UTC | #3
Hi Erik,

[Adding back the original MLs + CC list]

> -----Original Message-----

> From: Kaneda, Erik [mailto:erik.kaneda@intel.com]

> Sent: 28 October 2020 18:20

> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

> Moore, Robert <robert.moore@intel.com>; Wysocki, Rafael J

> <rafael.j.wysocki@intel.com>

> Subject: RE: [Devel] [RFC PATCH 1/4] ACPICA: IORT: Update for revision E

> 

> 

> 

> > -----Original Message-----

> > From: Shameerali Kolothum Thodi

> > <shameerali.kolothum.thodi@huawei.com>

> > Sent: Wednesday, October 28, 2020 1:15 AM

> > To: Moore, Robert <robert.moore@intel.com>

> > Cc: Kaneda, Erik <erik.kaneda@intel.com>

> > Subject: RE: [Devel] [RFC PATCH 1/4] ACPICA: IORT: Update for revision

> > E

> >

> > Hi,

> >

> > > -----Original Message-----

> > > From: Moore, Robert [mailto:robert.moore@intel.com]

> > > Sent: 27 October 2020 21:46

> > > To: Shameerali Kolothum Thodi

> > <shameerali.kolothum.thodi@huawei.com>

> > > Cc: Kaneda, Erik <erik.kaneda@intel.com>

> > > Subject: RE: [Devel] [RFC PATCH 1/4] ACPICA: IORT: Update for

> > > revision E

> > >

> > > This patch will need to be ported to the native ACPICA format.

> >

> > Thanks for your feedback. Sorry that, I am not familiar with the process here.

> > As mentioned

> > below, I thought a pull request via acpica git is enough, which you

> > can find here,

> >

> > https://github.com/acpica/acpica/pull/638

> >

> > The above pull includes this header file change + other changes

> > related to RMR for tools.

> >

> > Please let me know what else needs to be done when you say "native

> > format".

> 

> Oh ok, thanks for the pull request. You're submitting this as an RFC for linux. Do

> you expect the IORT definition to change throughout linux's RFC period? If you

> don't plan on changing the IORT definition, we can look at the pull request.


The IORT revision E document is published here,
https://developer.arm.com/documentation/den0049/latest/
and I don’t think it will change now (But ARM folks can confirm this).

I submitted this as an RFC, because of the very dependency on this actbl2.h
header updates and this being not available in kernel. 

> Once we merge it, I'll submit the ACPICA patches to Rafael after we do a

> release.


Ok. Thanks for the details. Looking forward to getting this merged to kernel soon :)

Thanks,
Shameer
 
> Erik

> >

> > Thanks,

> > Shameer

> >

> >

> > >

> > >

> > > -----Original Message-----

> > > From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>

> > > Sent: Tuesday, October 27, 2020 4:27 AM

> > > To: linux-arm-kernel@lists.infradead.org;

> > > linux-acpi@vger.kernel.org; iommu@lists.linux-foundation.org;

> > > devel@acpica.org

> > > Cc: linuxarm@huawei.com; lorenzo.pieralisi@arm.com; joro@8bytes.org;

> > > robin.murphy@arm.com; wanghuiqiang@huawei.com;

> > > jonathan.cameron@huawei.com

> > > Subject: [Devel] [RFC PATCH 1/4] ACPICA: IORT: Update for revision E

> > >

> > > IORT revision E contains a few additions like,

> > >     -Added an identifier field in the node descriptors to aid table

> > >      cross-referencing.

> > >     -Introduced the Reserved Memory Range(RMR) node. This is used

> > >      to describe memory ranges that are used by endpoints and

> > > requires

> > >      a unity mapping in SMMU.

> > >     -Introduced a flag in the RC node to express support for PRI.

> > >

> > > Signed-off-by: Shameer Kolothum

> > <shameerali.kolothum.thodi@huawei.com>

> > > ---

> > >  -This should be updated through acpica git. I have sent out a pull

> > >   request for the same here,

> > >   https://github.com/acpica/acpica/pull/638

> > >

> > > Please help to review.

> > > ---

> > >  include/acpi/actbl2.h | 25 +++++++++++++++++++------

> > >  1 file changed, 19 insertions(+), 6 deletions(-)

> > >

> > > diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index

> > > ec66779cb193..274fce7b5c01 100644

> > > --- a/include/acpi/actbl2.h

> > > +++ b/include/acpi/actbl2.h

> > > @@ -68,7 +68,7 @@

> > >   * IORT - IO Remapping Table

> > >   *

> > >   * Conforms to "IO Remapping Table System Software on ARM

> > > Platforms",

> > > - * Document number: ARM DEN 0049D, March 2018

> > > + * Document number: ARM DEN 0049E, June 2020

> > >   *

> > >

> > >

> > **********************************************************

> > ******

> > > **************/

> > >

> > > @@ -86,7 +86,8 @@ struct acpi_iort_node {

> > >  	u8 type;

> > >  	u16 length;

> > >  	u8 revision;

> > > -	u32 reserved;

> > > +	u16 reserved;

> > > +	u16 identifier;

> > >  	u32 mapping_count;

> > >  	u32 mapping_offset;

> > >  	char node_data[1];

> > > @@ -100,7 +101,8 @@ enum acpi_iort_node_type {

> > >  	ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,

> > >  	ACPI_IORT_NODE_SMMU = 0x03,

> > >  	ACPI_IORT_NODE_SMMU_V3 = 0x04,

> > > -	ACPI_IORT_NODE_PMCG = 0x05

> > > +	ACPI_IORT_NODE_PMCG = 0x05,

> > > +	ACPI_IORT_NODE_RMR = 0x06,

> > >  };

> > >

> > >  struct acpi_iort_id_mapping {

> > > @@ -167,10 +169,10 @@ struct acpi_iort_root_complex {

> > >  	u8 reserved[3];		/* Reserved, must be zero */

> > >  };

> > >

> > > -/* Values for ats_attribute field above */

> > > +/* Masks for ats_attribute field above */

> > >

> > > -#define ACPI_IORT_ATS_SUPPORTED         0x00000001	/* The

> root

> > > complex supports ATS */

> > > -#define ACPI_IORT_ATS_UNSUPPORTED       0x00000000	/* The

> root

> > > complex doesn't support ATS */

> > > +#define ACPI_IORT_ATS_SUPPORTED         (1)	/* The root complex

> > > supports ATS */

> > > +#define ACPI_IORT_PRI_SUPPORTED         (1<<1)	/* The root

> complex

> > > supports PRI */

> > >

> > >  struct acpi_iort_smmu {

> > >  	u64 base_address;	/* SMMU base address */

> > > @@ -241,6 +243,17 @@ struct acpi_iort_pmcg {

> > >  	u64 page1_base_address;

> > >  };

> > >

> > > +struct acpi_iort_rmr {

> > > +	u32 rmr_count;

> > > +	u32 rmr_offset;

> > > +};

> > > +

> > > +struct acpi_iort_rmr_desc {

> > > +	u64 base_address;

> > > +	u64 length;

> > > +	u32 reserved;

> > > +};

> > > +

> > >

> > >

> > /**********************************************************

> > *****

> > > ****************

> > >   *

> > >   * IVRS - I/O Virtualization Reporting Structure

> > > --

> > > 2.17.1

> > > _______________________________________________

> > > Devel mailing list -- devel@acpica.org To unsubscribe send an email

> > > to

> > > devel-

> > leave@acpica.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name

> > > )s
Steven Price Nov. 6, 2020, 3:22 p.m. UTC | #4
On 28/10/2020 18:24, Shameerali Kolothum Thodi wrote:
> Hi Steve,

> 

>> -----Original Message-----

>> From: Steven Price [mailto:steven.price@arm.com]

>> Sent: 28 October 2020 16:44

>> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

>> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

>> iommu@lists.linux-foundation.org; devel@acpica.org

>> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

>> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

>> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>; robin.murphy@arm.com;

>> wanghuiqiang <wanghuiqiang@huawei.com>; Sami Mujawar

>> <Sami.Mujawar@arm.com>

>> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

>>

>> On 27/10/2020 11:26, Shameer Kolothum wrote:

>>> The series adds support to IORT RMR nodes specified in IORT

>>> Revision E -ARM DEN 0049E[0]. RMR nodes are used to describe memory

>>> ranges that are used by endpoints and require a unity mapping

>>> in SMMU.

>>

>> Hi Shameer,

>>

>> I've also been taking a look at RMR, and Sami is helping me get set up

>> so that I can do some testing. We're hoping to be able to test an EFI

>> framebuffer or splash screen - which has the added complication of the

>> unity mapping becoming redundant if a native display driver takes over

>> the display controller.

>>

>> I've looked through your series and the code looks correct to me.

> 

> Thanks for taking a look and the details.

> 

>> Hopefully I'll be able to give it some testing soon.

> 

> Cool. Please update once you get a chance run the tests.


Hi Shameer,

Just to update on this, for the EFI framebuffer use case I hit exactly 
the issue that Robin has mentioned in another thread - the RMR is 
effectively ignored because the display controller isn't being handled 
by Linux (so there's no device to link it to). The splash screen might 
similarly flicker as the SMMU reset will initially block the traffic 
before the RMR region is enabled.

Steve
Shameerali Kolothum Thodi Nov. 6, 2020, 4:17 p.m. UTC | #5
> -----Original Message-----

> From: Steven Price [mailto:steven.price@arm.com]

> Sent: 06 November 2020 15:22

> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

> iommu@lists.linux-foundation.org; devel@acpica.org

> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>; Sami Mujawar

> <Sami.Mujawar@arm.com>; robin.murphy@arm.com; wanghuiqiang

> <wanghuiqiang@huawei.com>

> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

> 

> On 28/10/2020 18:24, Shameerali Kolothum Thodi wrote:

> > Hi Steve,

> >

> >> -----Original Message-----

> >> From: Steven Price [mailto:steven.price@arm.com]

> >> Sent: 28 October 2020 16:44

> >> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

> >> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

> >> iommu@lists.linux-foundation.org; devel@acpica.org

> >> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

> >> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

> >> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>;

> robin.murphy@arm.com;

> >> wanghuiqiang <wanghuiqiang@huawei.com>; Sami Mujawar

> >> <Sami.Mujawar@arm.com>

> >> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

> >>

> >> On 27/10/2020 11:26, Shameer Kolothum wrote:

> >>> The series adds support to IORT RMR nodes specified in IORT

> >>> Revision E -ARM DEN 0049E[0]. RMR nodes are used to describe memory

> >>> ranges that are used by endpoints and require a unity mapping

> >>> in SMMU.

> >>

> >> Hi Shameer,

> >>

> >> I've also been taking a look at RMR, and Sami is helping me get set up

> >> so that I can do some testing. We're hoping to be able to test an EFI

> >> framebuffer or splash screen - which has the added complication of the

> >> unity mapping becoming redundant if a native display driver takes over

> >> the display controller.

> >>

> >> I've looked through your series and the code looks correct to me.

> >

> > Thanks for taking a look and the details.

> >

> >> Hopefully I'll be able to give it some testing soon.

> >

> > Cool. Please update once you get a chance run the tests.

> 

> Hi Shameer,


Hi Steve,

> Just to update on this, for the EFI framebuffer use case I hit exactly

> the issue that Robin has mentioned in another thread - the RMR is

> effectively ignored because the display controller isn't being handled

> by Linux (so there's no device to link it to).


Thanks for the update. Here, by "ignored "you meant get_resv_regions()
is not called or not?

 The splash screen might
> similarly flicker as the SMMU reset will initially block the traffic

> before the RMR region is enabled.


Does that mean you somehow managed to make the unity
mapping but there was flicker during the SMMU reset to
unity mapping setup period. Sorry I am trying to understand
the exact behavior observed in this case.

Thanks,
Shameer
Steven Price Nov. 6, 2020, 4:26 p.m. UTC | #6
On 06/11/2020 16:17, Shameerali Kolothum Thodi wrote:
> 

> 

>> -----Original Message-----

>> From: Steven Price [mailto:steven.price@arm.com]

>> Sent: 06 November 2020 15:22

>> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

>> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

>> iommu@lists.linux-foundation.org; devel@acpica.org

>> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

>> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

>> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>; Sami Mujawar

>> <Sami.Mujawar@arm.com>; robin.murphy@arm.com; wanghuiqiang

>> <wanghuiqiang@huawei.com>

>> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

>>

>> On 28/10/2020 18:24, Shameerali Kolothum Thodi wrote:

>>> Hi Steve,

>>>

>>>> -----Original Message-----

>>>> From: Steven Price [mailto:steven.price@arm.com]

>>>> Sent: 28 October 2020 16:44

>>>> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

>>>> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

>>>> iommu@lists.linux-foundation.org; devel@acpica.org

>>>> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

>>>> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

>>>> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>;

>> robin.murphy@arm.com;

>>>> wanghuiqiang <wanghuiqiang@huawei.com>; Sami Mujawar

>>>> <Sami.Mujawar@arm.com>

>>>> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

>>>>

>>>> On 27/10/2020 11:26, Shameer Kolothum wrote:

>>>>> The series adds support to IORT RMR nodes specified in IORT

>>>>> Revision E -ARM DEN 0049E[0]. RMR nodes are used to describe memory

>>>>> ranges that are used by endpoints and require a unity mapping

>>>>> in SMMU.

>>>>

>>>> Hi Shameer,

>>>>

>>>> I've also been taking a look at RMR, and Sami is helping me get set up

>>>> so that I can do some testing. We're hoping to be able to test an EFI

>>>> framebuffer or splash screen - which has the added complication of the

>>>> unity mapping becoming redundant if a native display driver takes over

>>>> the display controller.

>>>>

>>>> I've looked through your series and the code looks correct to me.

>>>

>>> Thanks for taking a look and the details.

>>>

>>>> Hopefully I'll be able to give it some testing soon.

>>>

>>> Cool. Please update once you get a chance run the tests.

>>

>> Hi Shameer,

> 

> Hi Steve,

> 

>> Just to update on this, for the EFI framebuffer use case I hit exactly

>> the issue that Robin has mentioned in another thread - the RMR is

>> effectively ignored because the display controller isn't being handled

>> by Linux (so there's no device to link it to).

> 

> Thanks for the update. Here, by "ignored "you meant get_resv_regions()

> is not called or not?


get_resv_regions() isn't called.

>   The splash screen might

>> similarly flicker as the SMMU reset will initially block the traffic

>> before the RMR region is enabled.

> 

> Does that mean you somehow managed to make the unity

> mapping but there was flicker during the SMMU reset to

> unity mapping setup period. Sorry I am trying to understand

> the exact behavior observed in this case.


I haven't yet got this completely working (on the board which I'm 
testing the display controller doesn't have any existing ACPI bindings). 
However from what I understand the SMMU reset would block all memory 
access for the display controller before the RMR region would be setup. 
I'm going to try to get the display controller working with ACPI so I 
can test this properly.

Steve
Robin Murphy Nov. 6, 2020, 5:09 p.m. UTC | #7
On 2020-11-06 16:26, Steven Price wrote:
> On 06/11/2020 16:17, Shameerali Kolothum Thodi wrote:

>>

>>

>>> -----Original Message-----

>>> From: Steven Price [mailto:steven.price@arm.com]

>>> Sent: 06 November 2020 15:22

>>> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

>>> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

>>> iommu@lists.linux-foundation.org; devel@acpica.org

>>> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

>>> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

>>> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>; Sami Mujawar

>>> <Sami.Mujawar@arm.com>; robin.murphy@arm.com; wanghuiqiang

>>> <wanghuiqiang@huawei.com>

>>> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

>>>

>>> On 28/10/2020 18:24, Shameerali Kolothum Thodi wrote:

>>>> Hi Steve,

>>>>

>>>>> -----Original Message-----

>>>>> From: Steven Price [mailto:steven.price@arm.com]

>>>>> Sent: 28 October 2020 16:44

>>>>> To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>;

>>>>> linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org;

>>>>> iommu@lists.linux-foundation.org; devel@acpica.org

>>>>> Cc: lorenzo.pieralisi@arm.com; joro@8bytes.org; Jonathan Cameron

>>>>> <jonathan.cameron@huawei.com>; Linuxarm <linuxarm@huawei.com>;

>>>>> Guohanjun (Hanjun Guo) <guohanjun@huawei.com>;

>>> robin.murphy@arm.com;

>>>>> wanghuiqiang <wanghuiqiang@huawei.com>; Sami Mujawar

>>>>> <Sami.Mujawar@arm.com>

>>>>> Subject: Re: [RFC PATCH 0/4] ACPI/IORT: Support for IORT RMR node

>>>>>

>>>>> On 27/10/2020 11:26, Shameer Kolothum wrote:

>>>>>> The series adds support to IORT RMR nodes specified in IORT

>>>>>> Revision E -ARM DEN 0049E[0]. RMR nodes are used to describe memory

>>>>>> ranges that are used by endpoints and require a unity mapping

>>>>>> in SMMU.

>>>>>

>>>>> Hi Shameer,

>>>>>

>>>>> I've also been taking a look at RMR, and Sami is helping me get set up

>>>>> so that I can do some testing. We're hoping to be able to test an EFI

>>>>> framebuffer or splash screen - which has the added complication of the

>>>>> unity mapping becoming redundant if a native display driver takes over

>>>>> the display controller.

>>>>>

>>>>> I've looked through your series and the code looks correct to me.

>>>>

>>>> Thanks for taking a look and the details.

>>>>

>>>>> Hopefully I'll be able to give it some testing soon.

>>>>

>>>> Cool. Please update once you get a chance run the tests.

>>>

>>> Hi Shameer,

>>

>> Hi Steve,

>>

>>> Just to update on this, for the EFI framebuffer use case I hit exactly

>>> the issue that Robin has mentioned in another thread - the RMR is

>>> effectively ignored because the display controller isn't being handled

>>> by Linux (so there's no device to link it to).

>>

>> Thanks for the update. Here, by "ignored "you meant get_resv_regions()

>> is not called or not?

> 

> get_resv_regions() isn't called.


Right, AIUI the EFI framebuffer "device" pretty much just represents a 
magic region of RAM, whose existence is based on EFI services - see 
register_gop_device() - regardless of whether the underlying physical 
hardware is described in DSDT and IORT such that a tangential 
iommu_probe_device() call might happen at all.

Robin.

>>   The splash screen might

>>> similarly flicker as the SMMU reset will initially block the traffic

>>> before the RMR region is enabled.

>>

>> Does that mean you somehow managed to make the unity

>> mapping but there was flicker during the SMMU reset to

>> unity mapping setup period. Sorry I am trying to understand

>> the exact behavior observed in this case.

> 

> I haven't yet got this completely working (on the board which I'm 

> testing the display controller doesn't have any existing ACPI bindings). 

> However from what I understand the SMMU reset would block all memory 

> access for the display controller before the RMR region would be setup. 

> I'm going to try to get the display controller working with ACPI so I 

> can test this properly.

> 

> Steve