rename dom0 to hardware_domain

This should not change any functionality other than renaming the global
variable.  In a few cases (primarily the domain building code), a local
variable or argument named dom0 was created and used instead of the
global hardware_domain to clarify that the domain being used in this
case is actually domain 0.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Christoph Egger <chegger@amazon.de>
Acked-by: Keir Fraser <keir@xen.org>
This commit is contained in:
Daniel De Graaf authored and Jan Beulich committed 2014-04-11 11:20:55 +02:00
1 parent 920641d9c4
commit c86ccbf0b7
26 files changed
+68 -62

No files matched your search

+1 -1
View File
@@ -50,7 +50,7 @@ custom_param("dom0_mem", parse_dom0_mem);
*/
#define DOM0_FDT_EXTRA_SIZE (128 + sizeof(struct fdt_reserve_entry))
struct vcpu *__init alloc_dom0_vcpu0(void)
struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
{
if ( opt_dom0_max_vcpus == 0 )
opt_dom0_max_vcpus = num_online_cpus();
+3 -2
View File
@@ -663,6 +663,7 @@ void __init start_xen(unsigned long boot_phys_offset,
size_t fdt_size;
int cpus, i;
const char *cmdline;
struct domain *dom0;
setup_cache();
@@ -760,8 +761,8 @@ void __init start_xen(unsigned long boot_phys_offset,
do_initcalls();
/* Create initial domain 0. */
dom0 = domain_create(0, 0, 0);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0() == NULL) )
hardware_domain = dom0 = domain_create(0, 0, 0);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
panic("Error creating domain 0");
dom0->is_privileged = 1;
+1 -1
View File
@@ -972,7 +972,7 @@ static void set_cx(
cx->entry_method = ACPI_CSTATE_EM_HALT;
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
if ( ioports_deny_access(dom0, cx->address, cx->address) )
if ( ioports_deny_access(hardware_domain, cx->address, cx->address) )
printk(XENLOG_WARNING "Could not deny access to port %04x\n",
cx->address);
cx->entry_method = ACPI_CSTATE_EM_SYSIO;
+3 -2
View File
@@ -5,8 +5,9 @@
int vmce_init(struct cpuinfo_x86 *c);
#define dom0_vmce_enabled() (dom0 && dom0->max_vcpus && dom0->vcpu[0] \
&& guest_enabled_event(dom0->vcpu[0], VIRQ_MCA))
#define dom0_vmce_enabled() (hardware_domain && hardware_domain->max_vcpus \
&& hardware_domain->vcpu[0] \
&& guest_enabled_event(hardware_domain->vcpu[0], VIRQ_MCA))
int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn);
+1 -1
View File
@@ -205,7 +205,7 @@ void machine_crash_shutdown(void)
info = kexec_crash_save_info();
info->xen_phys_start = xen_phys_start;
info->dom0_pfn_to_mfn_frame_list_list =
arch_get_pfn_to_mfn_frame_list_list(dom0);
arch_get_pfn_to_mfn_frame_list_list(hardware_domain);
}
/*
+19 -18
View File
@@ -100,7 +100,7 @@ static void __init parse_dom0_max_vcpus(const char *s)
}
custom_param("dom0_max_vcpus", parse_dom0_max_vcpus);
struct vcpu *__init alloc_dom0_vcpu0(void)
struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
{
unsigned max_vcpus;
@@ -302,7 +302,7 @@ static void __init process_dom0_ioports_disable(void)
printk("Disabling dom0 access to ioport range %04lx-%04lx\n",
io_from, io_to);
if ( ioports_deny_access(dom0, io_from, io_to) != 0 )
if ( ioports_deny_access(hardware_domain, io_from, io_to) != 0 )
BUG();
}
}
@@ -1082,27 +1082,28 @@ int __init construct_dom0(
rc = 0;
/* DOM0 is permitted full I/O capabilities. */
rc |= ioports_permit_access(dom0, 0, 0xFFFF);
rc |= iomem_permit_access(dom0, 0UL, ~0UL);
rc |= irqs_permit_access(dom0, 1, nr_irqs_gsi - 1);
/* The hardware domain is initially permitted full I/O capabilities. */
rc |= ioports_permit_access(hardware_domain, 0, 0xFFFF);
rc |= iomem_permit_access(hardware_domain, 0UL, ~0UL);
rc |= irqs_permit_access(hardware_domain, 1, nr_irqs_gsi - 1);
/*
* Modify I/O port access permissions.
*/
/* Master Interrupt Controller (PIC). */
rc |= ioports_deny_access(dom0, 0x20, 0x21);
rc |= ioports_deny_access(hardware_domain, 0x20, 0x21);
/* Slave Interrupt Controller (PIC). */
rc |= ioports_deny_access(dom0, 0xA0, 0xA1);
rc |= ioports_deny_access(hardware_domain, 0xA0, 0xA1);
/* Interval Timer (PIT). */
rc |= ioports_deny_access(dom0, 0x40, 0x43);
rc |= ioports_deny_access(hardware_domain, 0x40, 0x43);
/* PIT Channel 2 / PC Speaker Control. */
rc |= ioports_deny_access(dom0, 0x61, 0x61);
rc |= ioports_deny_access(hardware_domain, 0x61, 0x61);
/* ACPI PM Timer. */
if ( pmtmr_ioport )
rc |= ioports_deny_access(dom0, pmtmr_ioport, pmtmr_ioport + 3);
rc |= ioports_deny_access(hardware_domain, pmtmr_ioport,
pmtmr_ioport + 3);
/* PCI configuration space (NB. 0xcf8 has special treatment). */
rc |= ioports_deny_access(dom0, 0xcfc, 0xcff);
rc |= ioports_deny_access(hardware_domain, 0xcfc, 0xcff);
/* Command-line I/O ranges. */
process_dom0_ioports_disable();
@@ -1113,22 +1114,22 @@ int __init construct_dom0(
if ( mp_lapic_addr != 0 )
{
mfn = paddr_to_pfn(mp_lapic_addr);
rc |= iomem_deny_access(dom0, mfn, mfn);
rc |= iomem_deny_access(hardware_domain, mfn, mfn);
}
/* I/O APICs. */
for ( i = 0; i < nr_ioapics; i++ )
{
mfn = paddr_to_pfn(mp_ioapics[i].mpc_apicaddr);
if ( !rangeset_contains_singleton(mmio_ro_ranges, mfn) )
rc |= iomem_deny_access(dom0, mfn, mfn);
rc |= iomem_deny_access(hardware_domain, mfn, mfn);
}
/* MSI range. */
rc |= iomem_deny_access(dom0, paddr_to_pfn(MSI_ADDR_BASE_LO),
rc |= iomem_deny_access(hardware_domain, paddr_to_pfn(MSI_ADDR_BASE_LO),
paddr_to_pfn(MSI_ADDR_BASE_LO +
MSI_ADDR_DEST_ID_MASK));
/* HyperTransport range. */
if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
rc |= iomem_deny_access(dom0, paddr_to_pfn(0xfdULL << 32),
rc |= iomem_deny_access(hardware_domain, paddr_to_pfn(0xfdULL << 32),
paddr_to_pfn((1ULL << 40) - 1));
/* Remove access to E820_UNUSABLE I/O regions above 1MB. */
@@ -1140,7 +1141,7 @@ int __init construct_dom0(
if ( (e820.map[i].type == E820_UNUSABLE) &&
(e820.map[i].size != 0) &&
(sfn <= efn) )
rc |= iomem_deny_access(dom0, sfn, efn);
rc |= iomem_deny_access(hardware_domain, sfn, efn);
}
BUG_ON(rc != 0);
@@ -1149,7 +1150,7 @@ int __init construct_dom0(
printk(" Xen warning: dom0 kernel broken ELF: %s\n",
elf_check_broken(&elf));
iommu_dom0_init(dom0);
iommu_dom0_init(hardware_domain);
return 0;
out:
+4 -4
View File
@@ -2363,7 +2363,7 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
* that dom0 pirq == irq.
*/
pirq = (irq >= 256) ? irq : rte.vector;
if ( (pirq < 0) || (pirq >= dom0->nr_pirqs) )
if ( (pirq < 0) || (pirq >= hardware_domain->nr_pirqs) )
return -EINVAL;
if ( desc->action )
@@ -2399,10 +2399,10 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val)
printk(XENLOG_INFO "allocated vector %02x for irq %d\n", ret, irq);
}
spin_lock(&dom0->event_lock);
ret = map_domain_pirq(dom0, pirq, irq,
spin_lock(&hardware_domain->event_lock);
ret = map_domain_pirq(hardware_domain, pirq, irq,
MAP_PIRQ_TYPE_GSI, NULL);
spin_unlock(&dom0->event_lock);
spin_unlock(&hardware_domain->event_lock);
if ( ret < 0 )
return ret;
+4 -4
View File
@@ -185,9 +185,9 @@ int create_irq(int node)
desc->arch.used = IRQ_UNUSED;
irq = ret;
}
else if ( dom0 )
else if ( hardware_domain )
{
ret = irq_permit_access(dom0, irq);
ret = irq_permit_access(hardware_domain, irq);
if ( ret )
printk(XENLOG_G_ERR
"Could not grant Dom0 access to IRQ%d (error %d)\n",
@@ -205,9 +205,9 @@ void destroy_irq(unsigned int irq)
BUG_ON(!MSI_IRQ(irq));
if ( dom0 )
if ( hardware_domain )
{
int err = irq_deny_access(dom0, irq);
int err = irq_deny_access(hardware_domain, irq);
if ( err )
printk(XENLOG_G_ERR
+1 -1
View File
@@ -5222,7 +5222,7 @@ void *alloc_xen_pagetable(void)
{
void *ptr = alloc_xenheap_page();
BUG_ON(!dom0 && !ptr);
BUG_ON(!hardware_domain && !ptr);
return ptr;
}
+1 -1
View File
@@ -519,7 +519,7 @@ static void do_nmi_stats(unsigned char key)
for_each_online_cpu ( i )
printk("%3d\t%3d\n", i, nmi_count(i));
if ( ((d = dom0) == NULL) || (d->vcpu == NULL) ||
if ( ((d = hardware_domain) == NULL) || (d->vcpu == NULL) ||
((v = d->vcpu[0]) == NULL) )
return;
+3 -2
View File
@@ -547,6 +547,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
unsigned long nr_pages, raw_max_page, modules_headroom, *module_map;
int i, j, e820_warn = 0, bytes = 0;
bool_t acpi_boot_table_init_done = 0;
struct domain *dom0;
struct ns16550_defaults ns16550 = {
.data_bits = 8,
.parity = 'n',
@@ -1338,8 +1339,8 @@ void __init noreturn __start_xen(unsigned long mbi_p)
panic("Could not protect TXT memory regions");
/* Create initial domain 0. */
dom0 = domain_create(0, DOMCRF_s3_integrity, 0);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0() == NULL) )
hardware_domain = dom0 = domain_create(0, DOMCRF_s3_integrity, 0);
if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) )
panic("Error creating domain 0");
dom0->is_privileged = 1;
+1 -1
View File
@@ -3152,7 +3152,7 @@ void async_exception_cleanup(struct vcpu *curr)
static void nmi_dom0_report(unsigned int reason_idx)
{
struct domain *d = dom0;
struct domain *d = hardware_domain;
if ( (d == NULL) || (d->vcpu == NULL) || (d->vcpu[0] == NULL) )
return;
+3 -3
View File
@@ -1447,15 +1447,15 @@ int memory_add(unsigned long spfn, unsigned long epfn, unsigned int pxm)
if ( ret )
goto destroy_m2p;
if ( !need_iommu(dom0) )
if ( !need_iommu(hardware_domain) )
{
for ( i = spfn; i < epfn; i++ )
if ( iommu_map_page(dom0, i, i, IOMMUF_readable|IOMMUF_writable) )
if ( iommu_map_page(hardware_domain, i, i, IOMMUF_readable|IOMMUF_writable) )
break;
if ( i != epfn )
{
while (i-- > old_max)
iommu_unmap_page(dom0, i);
iommu_unmap_page(hardware_domain, i);
goto destroy_m2p;
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ DEFINE_RCU_READ_LOCK(domlist_read_lock);
static struct domain *domain_hash[DOMAIN_HASH_SIZE];
struct domain *domain_list;
struct domain *dom0;
struct domain *hardware_domain __read_mostly;
struct vcpu *idle_vcpu[NR_CPUS] __read_mostly;
+1 -1
View File
@@ -743,7 +743,7 @@ void send_global_virq(uint32_t virq)
ASSERT(virq < NR_VIRQS);
ASSERT(virq_is_global(virq));
send_guest_global_virq(global_virq_handlers[virq] ?: dom0, virq);
send_guest_global_virq(global_virq_handlers[virq] ?: hardware_domain, virq);
}
int set_global_virq_handler(struct domain *d, uint32_t virq)
+1 -1
View File
@@ -872,7 +872,7 @@ static int kexec_load_slot(struct kexec_image *kimage)
static uint16_t kexec_load_v1_arch(void)
{
#ifdef CONFIG_X86
return is_pv_32on64_domain(dom0) ? EM_386 : EM_X86_64;
return is_pv_32on64_domain(hardware_domain) ? EM_386 : EM_X86_64;
#else
return EM_NONE;
#endif
+2 -2
View File
@@ -172,12 +172,12 @@ static void dump_dom0_registers(unsigned char key)
{
struct vcpu *v;
if ( dom0 == NULL )
if ( hardware_domain == NULL )
return;
printk("'%c' pressed -> dumping Dom0's registers\n", key);
for_each_vcpu ( dom0, v )
for_each_vcpu ( hardware_domain, v )
{
if ( alt_key_handling && softirq_pending(smp_processor_id()) )
{
+1 -1
View File
@@ -219,7 +219,7 @@ static int alloc_xenoprof_struct(
bufsize = sizeof(struct xenoprof_buf);
i = sizeof(struct event_log);
#ifdef CONFIG_COMPAT
d->xenoprof->is_compat = is_pv_32on64_domain(is_passive ? dom0 : d);
d->xenoprof->is_compat = is_pv_32on64_domain(is_passive ? hardware_domain : d);
if ( XENOPROF_COMPAT(d->xenoprof) )
{
bufsize = sizeof(struct compat_oprof_buf);
+3 -1
View File
@@ -726,10 +726,12 @@ static void __init ns16550_endboot(struct serial_port *port)
{
#ifdef HAS_IOPORTS
struct ns16550 *uart = port->uart;
int rv;
if ( uart->remapped_io_base )
return;
if ( ioports_deny_access(dom0, uart->io_base, uart->io_base + 7) != 0 )
rv = ioports_deny_access(hardware_domain, uart->io_base, uart->io_base + 7);
if ( rv != 0 )
BUG();
#endif
}
+1 -1
View File
@@ -403,7 +403,7 @@ static int amd_iommu_assign_device(struct domain *d, u8 devfn,
ivrs_mappings[req_id].read_permission);
}
return reassign_device(dom0, d, devfn, pdev);
return reassign_device(hardware_domain, d, devfn, pdev);
}
static void deallocate_next_page_table(struct page_info *pg, int level)
+5 -5
View File
@@ -265,7 +265,7 @@ static void iommu_teardown(struct domain *d)
}
/*
* If the device isn't owned by dom0, it means it already
* If the device isn't owned by the hardware domain, it means it already
* has been assigned to other domain, or it doesn't exist.
*/
static int device_assigned(u16 seg, u8 bus, u8 devfn)
@@ -273,7 +273,7 @@ static int device_assigned(u16 seg, u8 bus, u8 devfn)
struct pci_dev *pdev;
spin_lock(&pcidevs_lock);
pdev = pci_get_pdev_by_domain(dom0, seg, bus, devfn);
pdev = pci_get_pdev_by_domain(hardware_domain, seg, bus, devfn);
spin_unlock(&pcidevs_lock);
return pdev ? 0 : -EBUSY;
@@ -312,7 +312,7 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
d->need_iommu = 1;
}
pdev = pci_get_pdev_by_domain(dom0, seg, bus, devfn);
pdev = pci_get_pdev_by_domain(hardware_domain, seg, bus, devfn);
if ( !pdev )
{
rc = pci_get_pdev(seg, bus, devfn) ? -EBUSY : -ENODEV;
@@ -507,7 +507,7 @@ int deassign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
devfn += pdev->phantom_stride;
if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) )
break;
ret = hd->platform_ops->reassign_device(d, dom0, devfn, pdev);
ret = hd->platform_ops->reassign_device(d, hardware_domain, devfn, pdev);
if ( !ret )
continue;
@@ -517,7 +517,7 @@ int deassign_device(struct domain *d, u16 seg, u8 bus, u8 devfn)
}
devfn = pdev->devfn;
ret = hd->platform_ops->reassign_device(d, dom0, devfn, pdev);
ret = hd->platform_ops->reassign_device(d, hardware_domain, devfn, pdev);
if ( ret )
{
dprintk(XENLOG_G_ERR,
+2 -2
View File
@@ -569,7 +569,7 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *info)
ret = 0;
if ( !pdev->domain )
{
pdev->domain = dom0;
pdev->domain = hardware_domain;
ret = iommu_add_device(pdev);
if ( ret )
{
@@ -577,7 +577,7 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn, const struct pci_dev_info *info)
goto out;
}
list_add(&pdev->domain_list, &dom0->arch.pdev_list);
list_add(&pdev->domain_list, &hardware_domain->arch.pdev_list);
}
else
iommu_enable_device(pdev);
+2 -2
View File
@@ -1667,7 +1667,7 @@ static int reassign_device_ownership(
* can attempt to send arbitrary LAPIC/MSI messages. We are unprotected
* by the root complex unless interrupt remapping is enabled.
*/
if ( (target != dom0) && !iommu_intremap )
if ( (target != hardware_domain) && !iommu_intremap )
untrusted_msi = 1;
ret = domain_context_unmap(source, devfn, pdev);
@@ -2270,7 +2270,7 @@ static int intel_iommu_assign_device(
if ( list_empty(&acpi_drhd_units) )
return -ENODEV;
ret = reassign_device_ownership(dom0, d, devfn, pdev);
ret = reassign_device_ownership(hardware_domain, d, devfn, pdev);
if ( ret )
goto done;
+1 -1
View File
@@ -87,7 +87,7 @@ enum domain_type {
#endif
extern int dom0_11_mapping;
#define is_domain_direct_mapped(d) ((d) == dom0 && dom0_11_mapping)
#define is_domain_direct_mapped(d) ((d) == hardware_domain && dom0_11_mapping)
struct vtimer {
struct vcpu *v;
+1 -1
View File
@@ -12,7 +12,7 @@ typedef union {
struct vcpu *alloc_vcpu(
struct domain *d, unsigned int vcpu_id, unsigned int cpu_id);
struct vcpu *alloc_dom0_vcpu0(void);
struct vcpu *alloc_dom0_vcpu0(struct domain *dom0);
int vcpu_reset(struct vcpu *);
struct xen_domctl_getdomaininfo;
+2 -2
View File
@@ -43,8 +43,8 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_runstate_info_compat_t);
#define SCHED_STAT_CRANK(_X) (perfc_incr(_X))
/* A global pointer to the initial domain (DOM0). */
extern struct domain *dom0;
/* A global pointer to the hardware domain (usually DOM0). */
extern struct domain *hardware_domain;
#ifndef CONFIG_COMPAT
#define BITS_PER_EVTCHN_WORD(d) BITS_PER_XEN_ULONG
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.