lkml.org 
[lkml]   [2022]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.17 100/343] vfio/pci: Stub vfio_pci_vga_rw when !CONFIG_VFIO_PCI_VGA
    Date
    From: Alex Williamson <alex.williamson@redhat.com>

    [ Upstream commit 6e031ec0e5a2dda53e12e0d2a7e9b15b47a3c502 ]

    Resolve build errors reported against UML build for undefined
    ioport_map() and ioport_unmap() functions. Without this config
    option a device cannot have vfio_pci_core_device.has_vga set,
    so the existing function would always return -EINVAL anyway.

    Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
    Link: https://lore.kernel.org/r/20220123125737.2658758-1-geert@linux-m68k.org
    Link: https://lore.kernel.org/r/164306582968.3758255.15192949639574660648.stgit@omen
    Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/vfio/pci/vfio_pci_rdwr.c | 2 ++
    include/linux/vfio_pci_core.h | 9 +++++++++
    2 files changed, 11 insertions(+)

    diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c
    index 57d3b2cbbd8e..82ac1569deb0 100644
    --- a/drivers/vfio/pci/vfio_pci_rdwr.c
    +++ b/drivers/vfio/pci/vfio_pci_rdwr.c
    @@ -288,6 +288,7 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
    return done;
    }

    +#ifdef CONFIG_VFIO_PCI_VGA
    ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,
    size_t count, loff_t *ppos, bool iswrite)
    {
    @@ -355,6 +356,7 @@ ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,

    return done;
    }
    +#endif

    static void vfio_pci_ioeventfd_do_write(struct vfio_pci_ioeventfd *ioeventfd,
    bool test_mem)
    diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
    index ef9a44b6cf5d..ae6f4838ab75 100644
    --- a/include/linux/vfio_pci_core.h
    +++ b/include/linux/vfio_pci_core.h
    @@ -159,8 +159,17 @@ extern ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev,
    extern ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
    size_t count, loff_t *ppos, bool iswrite);

    +#ifdef CONFIG_VFIO_PCI_VGA
    extern ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,
    size_t count, loff_t *ppos, bool iswrite);
    +#else
    +static inline ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev,
    + char __user *buf, size_t count,
    + loff_t *ppos, bool iswrite)
    +{
    + return -EINVAL;
    +}
    +#endif

    extern long vfio_pci_ioeventfd(struct vfio_pci_core_device *vdev, loff_t offset,
    uint64_t data, int count, int fd);
    --
    2.35.1


    \
     
     \ /
      Last update: 2022-04-12 11:09    [W:4.048 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site