On 2018-01-12 01:22, Gustavo Lima Chaves wrote:
> The cell config creation tool was changed to allow writes to the PCIe
> capability, while Jailhouse will in fact only do reads and fake that
> writes happen. This is getting in so that Linux thinks it did OK at
> pci_disable_pcie_error_reporting() (disabling AER reporting for
> functions will be taken care of at hypervisor level on following
> patches). That is a common function call from .remove() struct
> pci_driver entries on drivers.

Let's first of all argue based on PCI: What are the registers in the
express cap that should be fake-writable?

I'd also like to have the core changes separated from the config tool
adaptions (which can then come last, possibly in one round).

> 
> This is a preparation for a scheme where Jailhouse will suppress all AER
> reporting on device handover.
> 
> Signed-off-by: Gustavo Lima Chaves <[email protected]>
> ---
>  hypervisor/include/jailhouse/pci.h | 1 +
>  hypervisor/pci.c                   | 9 ++++++++-
>  tools/jailhouse-config-create      | 7 +++++++
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/hypervisor/include/jailhouse/pci.h 
> b/hypervisor/include/jailhouse/pci.h
> index c0c10e96..720ecacd 100644
> --- a/hypervisor/include/jailhouse/pci.h
> +++ b/hypervisor/include/jailhouse/pci.h
> @@ -37,6 +37,7 @@
>  
>  #define PCI_CAP_MSI          0x05
>  #define PCI_CAP_MSIX         0x11
> +#define PCI_CAP_EXPRESS      0x10
>  
>  #define PCI_IVSHMEM_NUM_MMIO_REGIONS 2
>  
> diff --git a/hypervisor/pci.c b/hypervisor/pci.c
> index 2f95dd74..39f36f5f 100644
> --- a/hypervisor/pci.c
> +++ b/hypervisor/pci.c
> @@ -350,7 +350,14 @@ enum pci_access pci_cfg_write_moderate(struct pci_device 
> *device, u16 address,
>  
>               if (pci_update_msix(device, cap) < 0)
>                       return PCI_ACCESS_REJECT;
> -     }
> +     /*
> +      * Let Linux think it did OK at
> +      * pci_disable_pcie_error_reporting()—this will be taken care
> +      * of at hypervisor level. That is a common function call from
> +      * .remove() struct pci_driver entries on drivers.

Let's not argue referencing Linux unless it's really required.
Specifically avoid referencing functions in the kernel that may be
called differently tomorrow.

> +      */
> +     } else if (cap->id == PCI_CAP_EXPRESS)
> +             return PCI_ACCESS_DONE;

Style: use braces here as well because the whole block does.

>  
>       return PCI_ACCESS_PERFORM;
>  }
> diff --git a/tools/jailhouse-config-create b/tools/jailhouse-config-create
> index 505e8050..8ede9b28 100755
> --- a/tools/jailhouse-config-create
> +++ b/tools/jailhouse-config-create
> @@ -260,6 +260,13 @@ class PCICapability:
>                  (cap_reg,) = struct.unpack('<H', f.read(2))
>                  if (cap_reg & 0xf) >= 2:  # v2 capability
>                      len = 60
> +                # Let Linux think it did OK at
> +                # pci_disable_pcie_error_reporting(): this will be
> +                # taken care of at hypervisor level. That is a common
> +                # function call from .remove() struct pci_driver
> +                # entries on drivers. All writes to the capability
> +                # will have no effect, though.
> +                flags = PCICapability.RW
>                  has_extended_caps = True
>              elif id == 0x11:  # MSI-X
>                  # access will be moderated by hypervisor
> 

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to