hv: fix integer violations

- Fix the integer violations related to the following rules:
  1. The operands to shift operations (<<, >>) shall be unsigned
     integers.
  2. The operands to bit operations (&, |, ~) shall be unsigned
     integers.

- Replace 12U with CPU_PAGE_SHIFT when it is address shift case.

v1 -> v2:
 * use existed MACRO to get bus/slot/func values
 * update PCI_SLOT MACRO to make it more straightforward
 * remove the incorrect replacement of 12U with CPU_PAGE_SHIFT
   dmar_fault_msi_write

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shiqing Gao
2018-11-06 08:41:54 +08:00
committed by lijinxia
parent 65a2613ab6
commit 366042cac2
10 changed files with 20 additions and 22 deletions

View File

@@ -198,8 +198,8 @@ handle_dmar_devscope(struct dmar_dev_scope *dev_scope,
sizeof(struct acpi_dmar_pci_path);
bdf = dmar_path_bdf(path_len, apci_devscope->bus, path);
dev_scope->bus = (bdf >> 8) & 0xff;
dev_scope->devfun = bdf & 0xff;
dev_scope->bus = (bdf >> 8U) & 0xffU;
dev_scope->devfun = bdf & 0xffU;
return apci_devscope->length;
}

View File

@@ -176,7 +176,7 @@ static void update_trampoline_code_refs(uint64_t dest_pa)
val = dest_pa + trampoline_relo_addr(&trampoline_fixup_target);
ptr = hpa2hva(dest_pa + trampoline_relo_addr(&trampoline_fixup_cs));
*(uint16_t *)(ptr) = (uint16_t)((val >> 4) & 0xFFFFU);
*(uint16_t *)(ptr) = (uint16_t)((val >> 4U) & 0xFFFFU);
ptr = hpa2hva(dest_pa + trampoline_relo_addr(&trampoline_fixup_ip));
*(uint16_t *)(ptr) = (uint16_t)(val & 0xfU);