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

[Xen-changelog] [xen staging] ns16550: make PCI device hiding uniform



commit d5b7d10cb49cf8fcf1104606fb27b80233bb98c1
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Sep 3 15:58:08 2019 +0200
Commit:     Julien Grall <julien.grall@xxxxxxx>
CommitDate: Sun Sep 29 10:03:56 2019 +0100

    ns16550: make PCI device hiding uniform
    
    The difference between pci_hide_device() and pci_ro_device() is that
    the former only prevents a device from getting assigned to a guest,
    while the latter additionally arranges for Dom0 write attempts to the
    device's config space to be ignored/discarded. Whether we want one or
    the other certainly doesn't depend on whether the device is in our set
    of known devices. All that matters is whether we use a PCI device: Call
    pci_ro_device() in any such case.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxx>
---
 xen/drivers/char/ns16550.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index fcd3979a39..aa87c57fc9 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -763,23 +763,16 @@ static void __init ns16550_init_postirq(struct 
serial_port *port)
 #ifdef CONFIG_HAS_PCI
     if ( uart->bar || uart->ps_bdf_enable )
     {
-        if ( !uart->param )
-            pci_hide_device(0, uart->ps_bdf[0], PCI_DEVFN(uart->ps_bdf[1],
-                            uart->ps_bdf[2]));
-        else
-        {
-            if ( uart->param->mmio &&
-                 rangeset_add_range(mmio_ro_ranges,
-                                    uart->io_base,
-                                    uart->io_base + uart->io_size - 1) )
-                printk(XENLOG_INFO "Error while adding MMIO range of device to 
mmio_ro_ranges\n");
-
-            if ( pci_ro_device(0, uart->ps_bdf[0],
-                               PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2])) )
-                printk(XENLOG_INFO "Could not mark config space of 
%02x:%02x.%u read-only.\n",
-                                    uart->ps_bdf[0], uart->ps_bdf[1],
-                                    uart->ps_bdf[2]);
-        }
+        if ( uart->param && uart->param->mmio &&
+             rangeset_add_range(mmio_ro_ranges, uart->io_base,
+                                uart->io_base + uart->io_size - 1) )
+            printk(XENLOG_INFO "Error while adding MMIO range of device to 
mmio_ro_ranges\n");
+
+        if ( pci_ro_device(0, uart->ps_bdf[0],
+                           PCI_DEVFN(uart->ps_bdf[1], uart->ps_bdf[2])) )
+            printk(XENLOG_INFO "Could not mark config space of %02x:%02x.%u 
read-only.\n",
+                   uart->ps_bdf[0], uart->ps_bdf[1],
+                   uart->ps_bdf[2]);
 
         if ( uart->msi )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.