]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Pass value directly to pci_cfg_write_moderate
authorJan Kiszka <jan.kiszka@siemens.com>
Sun, 3 Aug 2014 19:11:37 +0000 (21:11 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Sun, 3 Aug 2014 19:22:00 +0000 (21:22 +0200)
Convert pass-by-reference to pass-by-value for the value
pci_cfg_write_moderate should handle. Reason: either we will emulate and
write in the context of the moderation, or we let the original value
pass as-is.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/pci.c
hypervisor/include/jailhouse/pci.h
hypervisor/pci.c

index d927fc067cffc2aa9769893438bb79534bb30366..fa4887ce3ebbea4dce799ffb3fa655bb55e6d1c7 100644 (file)
@@ -146,7 +146,7 @@ data_port_out_handler(struct registers *guest_regs, const struct cell *cell,
        u32 reg_data = get_rax_reg(guest_regs, size);
 
        if (pci_cfg_write_moderate(cell, device, address,
-                                  size, &reg_data) == PCI_ACCESS_REJECT)
+                                  size, reg_data) == PCI_ACCESS_REJECT)
                return -1;
 
        arch_pci_write_config(device->bdf, address, reg_data, size);
index 696a93c8192ee4d6117807a8bde428e0e6895212..1b3e7736f003777b67557b79f227c7d960755507 100644 (file)
@@ -37,7 +37,7 @@ pci_cfg_read_moderate(const struct cell *cell,
 enum pci_access
 pci_cfg_write_moderate(const struct cell *cell,
                       const struct jailhouse_pci_device *device, u16 address,
-                      unsigned int size, u32 *value);
+                      unsigned int size, u32 value);
 
 int pci_mmio_access_handler(const struct cell *cell, bool is_write, u64 addr,
                            u32 *value);
index 47a612035146d267fac5ab1ff2def2959f1a52f8..3d5553dbb31e280c3834992087b75fdc57ca7587 100644 (file)
@@ -194,16 +194,14 @@ pci_cfg_read_moderate(const struct cell *cell,
  * @device:    The device to be accessed; if NULL, access will be rejected
  * @address:   Config space address
  * @size:      Access size (1, 2 or 4 bytes)
- * @value:     Pointer to value to be written, initialized with cell value,
- *             set to the to-be-written hardware value if PCI_ACCESS_EMULATE
- *             is returned
+ * @value:     Value to be written
  *
  * Return: PCI_ACCESS_REJECT, PCI_ACCESS_PERFORM or PCI_ACCESS_EMULATE.
  */
 enum pci_access
 pci_cfg_write_moderate(const struct cell *cell,
                       const struct jailhouse_pci_device *device, u16 address,
-                      unsigned int size, u32 *value)
+                      unsigned int size, u32 value)
 {
        const struct jailhouse_pci_capability *cap;
        /* initialize list to work around wrong compiler warning */
@@ -286,8 +284,8 @@ int pci_init(void)
 int pci_mmio_access_handler(const struct cell *cell, bool is_write,
                            u64 addr, u32 *value)
 {
-       u32 mmcfg_offset, val, reg_addr;
        const struct jailhouse_pci_device *device;
+       u32 mmcfg_offset, reg_addr;
        enum pci_access access;
 
        if (!pci_space || addr < pci_mmcfg_addr ||
@@ -299,12 +297,11 @@ int pci_mmio_access_handler(const struct cell *cell, bool is_write,
        device = pci_get_assigned_device(cell, mmcfg_offset >> 12);
 
        if (is_write) {
-               val = *value;
                access = pci_cfg_write_moderate(cell, device, reg_addr, 4,
-                                               &val);
+                                               *value);
                if (access == PCI_ACCESS_REJECT)
                        goto invalid_access;
-               mmio_write32(pci_space + mmcfg_offset, val);
+               mmio_write32(pci_space + mmcfg_offset, *value);
        } else {
                access = pci_cfg_read_moderate(cell, device, reg_addr, 4,
                                               value);