xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: favor function parameter over global in construct_dom0()
@ 2014-10-02 13:36 Jan Beulich
  2014-10-02 13:46 ` Tim Deegan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jan Beulich @ 2014-10-02 13:36 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 4232 bytes --]

There's no reason to use the "hardware_domain" variable anywhere here,
making the code more cumbersome to read.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -270,7 +270,7 @@ static unsigned long __init compute_dom0
     return nr_pages;
 }
 
-static void __init process_dom0_ioports_disable(void)
+static void __init process_dom0_ioports_disable(struct domain *dom0)
 {
     unsigned long io_from, io_to;
     char *t, *s = opt_dom0_ioports_disable;
@@ -303,7 +303,7 @@ static void __init process_dom0_ioports_
         printk("Disabling dom0 access to ioport range %04lx-%04lx\n",
             io_from, io_to);
 
-        if ( ioports_deny_access(hardware_domain, io_from, io_to) != 0 )
+        if ( ioports_deny_access(dom0, io_from, io_to) != 0 )
             BUG();
     }
 }
@@ -1425,29 +1425,28 @@ int __init construct_dom0(
     rc = 0;
 
     /* 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);
+    rc |= ioports_permit_access(d, 0, 0xFFFF);
+    rc |= iomem_permit_access(d, 0UL, ~0UL);
+    rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /*
      * Modify I/O port access permissions.
      */
     /* Master Interrupt Controller (PIC). */
-    rc |= ioports_deny_access(hardware_domain, 0x20, 0x21);
+    rc |= ioports_deny_access(d, 0x20, 0x21);
     /* Slave Interrupt Controller (PIC). */
-    rc |= ioports_deny_access(hardware_domain, 0xA0, 0xA1);
+    rc |= ioports_deny_access(d, 0xA0, 0xA1);
     /* Interval Timer (PIT). */
-    rc |= ioports_deny_access(hardware_domain, 0x40, 0x43);
+    rc |= ioports_deny_access(d, 0x40, 0x43);
     /* PIT Channel 2 / PC Speaker Control. */
-    rc |= ioports_deny_access(hardware_domain, 0x61, 0x61);
+    rc |= ioports_deny_access(d, 0x61, 0x61);
     /* ACPI PM Timer. */
     if ( pmtmr_ioport )
-        rc |= ioports_deny_access(hardware_domain, pmtmr_ioport,
-		                          pmtmr_ioport + 3);
+        rc |= ioports_deny_access(d, pmtmr_ioport, pmtmr_ioport + 3);
     /* PCI configuration space (NB. 0xcf8 has special treatment). */
-    rc |= ioports_deny_access(hardware_domain, 0xcfc, 0xcff);
+    rc |= ioports_deny_access(d, 0xcfc, 0xcff);
     /* Command-line I/O ranges. */
-    process_dom0_ioports_disable();
+    process_dom0_ioports_disable(d);
 
     /*
      * Modify I/O memory access permissions.
@@ -1456,22 +1455,22 @@ int __init construct_dom0(
     if ( mp_lapic_addr != 0 )
     {
         mfn = paddr_to_pfn(mp_lapic_addr);
-        rc |= iomem_deny_access(hardware_domain, mfn, mfn);
+        rc |= iomem_deny_access(d, 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(hardware_domain, mfn, mfn);
+            rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
-    rc |= iomem_deny_access(hardware_domain, paddr_to_pfn(MSI_ADDR_BASE_LO),
+    rc |= iomem_deny_access(d, 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(hardware_domain, paddr_to_pfn(0xfdULL << 32),
+        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
                                 paddr_to_pfn((1ULL << 40) - 1));
 
     /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
@@ -1483,7 +1482,7 @@ int __init construct_dom0(
         if ( (e820.map[i].type == E820_UNUSABLE) &&
              (e820.map[i].size != 0) &&
              (sfn <= efn) )
-            rc |= iomem_deny_access(hardware_domain, sfn, efn);
+            rc |= iomem_deny_access(d, sfn, efn);
     }
 
     BUG_ON(rc != 0);



[-- Attachment #2: x86-Dom0-build-use-local.patch --]
[-- Type: text/plain, Size: 4293 bytes --]

x86: favor function parameter over global in construct_dom0()

There's no reason to use the "hardware_domain" variable anywhere here,
making the code more cumbersome to read.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -270,7 +270,7 @@ static unsigned long __init compute_dom0
     return nr_pages;
 }
 
-static void __init process_dom0_ioports_disable(void)
+static void __init process_dom0_ioports_disable(struct domain *dom0)
 {
     unsigned long io_from, io_to;
     char *t, *s = opt_dom0_ioports_disable;
@@ -303,7 +303,7 @@ static void __init process_dom0_ioports_
         printk("Disabling dom0 access to ioport range %04lx-%04lx\n",
             io_from, io_to);
 
-        if ( ioports_deny_access(hardware_domain, io_from, io_to) != 0 )
+        if ( ioports_deny_access(dom0, io_from, io_to) != 0 )
             BUG();
     }
 }
@@ -1425,29 +1425,28 @@ int __init construct_dom0(
     rc = 0;
 
     /* 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);
+    rc |= ioports_permit_access(d, 0, 0xFFFF);
+    rc |= iomem_permit_access(d, 0UL, ~0UL);
+    rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
 
     /*
      * Modify I/O port access permissions.
      */
     /* Master Interrupt Controller (PIC). */
-    rc |= ioports_deny_access(hardware_domain, 0x20, 0x21);
+    rc |= ioports_deny_access(d, 0x20, 0x21);
     /* Slave Interrupt Controller (PIC). */
-    rc |= ioports_deny_access(hardware_domain, 0xA0, 0xA1);
+    rc |= ioports_deny_access(d, 0xA0, 0xA1);
     /* Interval Timer (PIT). */
-    rc |= ioports_deny_access(hardware_domain, 0x40, 0x43);
+    rc |= ioports_deny_access(d, 0x40, 0x43);
     /* PIT Channel 2 / PC Speaker Control. */
-    rc |= ioports_deny_access(hardware_domain, 0x61, 0x61);
+    rc |= ioports_deny_access(d, 0x61, 0x61);
     /* ACPI PM Timer. */
     if ( pmtmr_ioport )
-        rc |= ioports_deny_access(hardware_domain, pmtmr_ioport,
-		                          pmtmr_ioport + 3);
+        rc |= ioports_deny_access(d, pmtmr_ioport, pmtmr_ioport + 3);
     /* PCI configuration space (NB. 0xcf8 has special treatment). */
-    rc |= ioports_deny_access(hardware_domain, 0xcfc, 0xcff);
+    rc |= ioports_deny_access(d, 0xcfc, 0xcff);
     /* Command-line I/O ranges. */
-    process_dom0_ioports_disable();
+    process_dom0_ioports_disable(d);
 
     /*
      * Modify I/O memory access permissions.
@@ -1456,22 +1455,22 @@ int __init construct_dom0(
     if ( mp_lapic_addr != 0 )
     {
         mfn = paddr_to_pfn(mp_lapic_addr);
-        rc |= iomem_deny_access(hardware_domain, mfn, mfn);
+        rc |= iomem_deny_access(d, 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(hardware_domain, mfn, mfn);
+            rc |= iomem_deny_access(d, mfn, mfn);
     }
     /* MSI range. */
-    rc |= iomem_deny_access(hardware_domain, paddr_to_pfn(MSI_ADDR_BASE_LO),
+    rc |= iomem_deny_access(d, 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(hardware_domain, paddr_to_pfn(0xfdULL << 32),
+        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
                                 paddr_to_pfn((1ULL << 40) - 1));
 
     /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
@@ -1483,7 +1482,7 @@ int __init construct_dom0(
         if ( (e820.map[i].type == E820_UNUSABLE) &&
              (e820.map[i].size != 0) &&
              (sfn <= efn) )
-            rc |= iomem_deny_access(hardware_domain, sfn, efn);
+            rc |= iomem_deny_access(d, sfn, efn);
     }
 
     BUG_ON(rc != 0);

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: favor function parameter over global in construct_dom0()
  2014-10-02 13:36 [PATCH] x86: favor function parameter over global in construct_dom0() Jan Beulich
@ 2014-10-02 13:46 ` Tim Deegan
  2014-10-02 15:11 ` Konrad Rzeszutek Wilk
  2014-10-02 15:19 ` Andrew Cooper
  2 siblings, 0 replies; 5+ messages in thread
From: Tim Deegan @ 2014-10-02 13:46 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser

At 14:36 +0100 on 02 Oct (1412257001), Jan Beulich wrote:
> There's no reason to use the "hardware_domain" variable anywhere here,
> making the code more cumbersome to read.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Tim Deegan <tim@xen.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: favor function parameter over global in construct_dom0()
  2014-10-02 13:36 [PATCH] x86: favor function parameter over global in construct_dom0() Jan Beulich
  2014-10-02 13:46 ` Tim Deegan
@ 2014-10-02 15:11 ` Konrad Rzeszutek Wilk
  2014-10-02 15:17   ` Jan Beulich
  2014-10-02 15:19 ` Andrew Cooper
  2 siblings, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-10-02 15:11 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Keir Fraser

On Thu, Oct 02, 2014 at 02:36:41PM +0100, Jan Beulich wrote:
> There's no reason to use the "hardware_domain" variable anywhere here,
> making the code more cumbersome to read.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/domain_build.c
> +++ b/xen/arch/x86/domain_build.c
> @@ -270,7 +270,7 @@ static unsigned long __init compute_dom0
>      return nr_pages;
>  }
>  
> -static void __init process_dom0_ioports_disable(void)
> +static void __init process_dom0_ioports_disable(struct domain *dom0)

Why not make that also 'd' ?

>  {
>      unsigned long io_from, io_to;
>      char *t, *s = opt_dom0_ioports_disable;
> @@ -303,7 +303,7 @@ static void __init process_dom0_ioports_
>          printk("Disabling dom0 access to ioport range %04lx-%04lx\n",
>              io_from, io_to);
>  
> -        if ( ioports_deny_access(hardware_domain, io_from, io_to) != 0 )
> +        if ( ioports_deny_access(dom0, io_from, io_to) != 0 )
>              BUG();
>      }
>  }
> @@ -1425,29 +1425,28 @@ int __init construct_dom0(
>      rc = 0;
>  
>      /* 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);
> +    rc |= ioports_permit_access(d, 0, 0xFFFF);
> +    rc |= iomem_permit_access(d, 0UL, ~0UL);
> +    rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
>  
>      /*
>       * Modify I/O port access permissions.
>       */
>      /* Master Interrupt Controller (PIC). */
> -    rc |= ioports_deny_access(hardware_domain, 0x20, 0x21);
> +    rc |= ioports_deny_access(d, 0x20, 0x21);
>      /* Slave Interrupt Controller (PIC). */
> -    rc |= ioports_deny_access(hardware_domain, 0xA0, 0xA1);
> +    rc |= ioports_deny_access(d, 0xA0, 0xA1);
>      /* Interval Timer (PIT). */
> -    rc |= ioports_deny_access(hardware_domain, 0x40, 0x43);
> +    rc |= ioports_deny_access(d, 0x40, 0x43);
>      /* PIT Channel 2 / PC Speaker Control. */
> -    rc |= ioports_deny_access(hardware_domain, 0x61, 0x61);
> +    rc |= ioports_deny_access(d, 0x61, 0x61);
>      /* ACPI PM Timer. */
>      if ( pmtmr_ioport )
> -        rc |= ioports_deny_access(hardware_domain, pmtmr_ioport,
> -		                          pmtmr_ioport + 3);
> +        rc |= ioports_deny_access(d, pmtmr_ioport, pmtmr_ioport + 3);
>      /* PCI configuration space (NB. 0xcf8 has special treatment). */
> -    rc |= ioports_deny_access(hardware_domain, 0xcfc, 0xcff);
> +    rc |= ioports_deny_access(d, 0xcfc, 0xcff);
>      /* Command-line I/O ranges. */
> -    process_dom0_ioports_disable();
> +    process_dom0_ioports_disable(d);
>  
>      /*
>       * Modify I/O memory access permissions.
> @@ -1456,22 +1455,22 @@ int __init construct_dom0(
>      if ( mp_lapic_addr != 0 )
>      {
>          mfn = paddr_to_pfn(mp_lapic_addr);
> -        rc |= iomem_deny_access(hardware_domain, mfn, mfn);
> +        rc |= iomem_deny_access(d, 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(hardware_domain, mfn, mfn);
> +            rc |= iomem_deny_access(d, mfn, mfn);
>      }
>      /* MSI range. */
> -    rc |= iomem_deny_access(hardware_domain, paddr_to_pfn(MSI_ADDR_BASE_LO),
> +    rc |= iomem_deny_access(d, 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(hardware_domain, paddr_to_pfn(0xfdULL << 32),
> +        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
>                                  paddr_to_pfn((1ULL << 40) - 1));
>  
>      /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
> @@ -1483,7 +1482,7 @@ int __init construct_dom0(
>          if ( (e820.map[i].type == E820_UNUSABLE) &&
>               (e820.map[i].size != 0) &&
>               (sfn <= efn) )
> -            rc |= iomem_deny_access(hardware_domain, sfn, efn);
> +            rc |= iomem_deny_access(d, sfn, efn);
>      }
>  
>      BUG_ON(rc != 0);
> 
> 

> x86: favor function parameter over global in construct_dom0()
> 
> There's no reason to use the "hardware_domain" variable anywhere here,
> making the code more cumbersome to read.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/domain_build.c
> +++ b/xen/arch/x86/domain_build.c
> @@ -270,7 +270,7 @@ static unsigned long __init compute_dom0
>      return nr_pages;
>  }
>  
> -static void __init process_dom0_ioports_disable(void)
> +static void __init process_dom0_ioports_disable(struct domain *dom0)
>  {
>      unsigned long io_from, io_to;
>      char *t, *s = opt_dom0_ioports_disable;
> @@ -303,7 +303,7 @@ static void __init process_dom0_ioports_
>          printk("Disabling dom0 access to ioport range %04lx-%04lx\n",
>              io_from, io_to);
>  
> -        if ( ioports_deny_access(hardware_domain, io_from, io_to) != 0 )
> +        if ( ioports_deny_access(dom0, io_from, io_to) != 0 )
>              BUG();
>      }
>  }
> @@ -1425,29 +1425,28 @@ int __init construct_dom0(
>      rc = 0;
>  
>      /* 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);
> +    rc |= ioports_permit_access(d, 0, 0xFFFF);
> +    rc |= iomem_permit_access(d, 0UL, ~0UL);
> +    rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
>  
>      /*
>       * Modify I/O port access permissions.
>       */
>      /* Master Interrupt Controller (PIC). */
> -    rc |= ioports_deny_access(hardware_domain, 0x20, 0x21);
> +    rc |= ioports_deny_access(d, 0x20, 0x21);
>      /* Slave Interrupt Controller (PIC). */
> -    rc |= ioports_deny_access(hardware_domain, 0xA0, 0xA1);
> +    rc |= ioports_deny_access(d, 0xA0, 0xA1);
>      /* Interval Timer (PIT). */
> -    rc |= ioports_deny_access(hardware_domain, 0x40, 0x43);
> +    rc |= ioports_deny_access(d, 0x40, 0x43);
>      /* PIT Channel 2 / PC Speaker Control. */
> -    rc |= ioports_deny_access(hardware_domain, 0x61, 0x61);
> +    rc |= ioports_deny_access(d, 0x61, 0x61);
>      /* ACPI PM Timer. */
>      if ( pmtmr_ioport )
> -        rc |= ioports_deny_access(hardware_domain, pmtmr_ioport,
> -		                          pmtmr_ioport + 3);
> +        rc |= ioports_deny_access(d, pmtmr_ioport, pmtmr_ioport + 3);
>      /* PCI configuration space (NB. 0xcf8 has special treatment). */
> -    rc |= ioports_deny_access(hardware_domain, 0xcfc, 0xcff);
> +    rc |= ioports_deny_access(d, 0xcfc, 0xcff);
>      /* Command-line I/O ranges. */
> -    process_dom0_ioports_disable();
> +    process_dom0_ioports_disable(d);
>  
>      /*
>       * Modify I/O memory access permissions.
> @@ -1456,22 +1455,22 @@ int __init construct_dom0(
>      if ( mp_lapic_addr != 0 )
>      {
>          mfn = paddr_to_pfn(mp_lapic_addr);
> -        rc |= iomem_deny_access(hardware_domain, mfn, mfn);
> +        rc |= iomem_deny_access(d, 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(hardware_domain, mfn, mfn);
> +            rc |= iomem_deny_access(d, mfn, mfn);
>      }
>      /* MSI range. */
> -    rc |= iomem_deny_access(hardware_domain, paddr_to_pfn(MSI_ADDR_BASE_LO),
> +    rc |= iomem_deny_access(d, 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(hardware_domain, paddr_to_pfn(0xfdULL << 32),
> +        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
>                                  paddr_to_pfn((1ULL << 40) - 1));
>  
>      /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
> @@ -1483,7 +1482,7 @@ int __init construct_dom0(
>          if ( (e820.map[i].type == E820_UNUSABLE) &&
>               (e820.map[i].size != 0) &&
>               (sfn <= efn) )
> -            rc |= iomem_deny_access(hardware_domain, sfn, efn);
> +            rc |= iomem_deny_access(d, sfn, efn);
>      }
>  
>      BUG_ON(rc != 0);

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: favor function parameter over global in construct_dom0()
  2014-10-02 15:11 ` Konrad Rzeszutek Wilk
@ 2014-10-02 15:17   ` Jan Beulich
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2014-10-02 15:17 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: xen-devel, Keir Fraser

>>> On 02.10.14 at 17:11, <konrad.wilk@oracle.com> wrote:
> On Thu, Oct 02, 2014 at 02:36:41PM +0100, Jan Beulich wrote:
>> There's no reason to use the "hardware_domain" variable anywhere here,
>> making the code more cumbersome to read.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> 
>> --- a/xen/arch/x86/domain_build.c
>> +++ b/xen/arch/x86/domain_build.c
>> @@ -270,7 +270,7 @@ static unsigned long __init compute_dom0
>>      return nr_pages;
>>  }
>>  
>> -static void __init process_dom0_ioports_disable(void)
>> +static void __init process_dom0_ioports_disable(struct domain *dom0)
> 
> Why not make that also 'd' ?

Because of the function name, matching style with alloc_dom0_vcpu0().

Jan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86: favor function parameter over global in construct_dom0()
  2014-10-02 13:36 [PATCH] x86: favor function parameter over global in construct_dom0() Jan Beulich
  2014-10-02 13:46 ` Tim Deegan
  2014-10-02 15:11 ` Konrad Rzeszutek Wilk
@ 2014-10-02 15:19 ` Andrew Cooper
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2014-10-02 15:19 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Keir Fraser


[-- Attachment #1.1: Type: text/plain, Size: 4565 bytes --]

On 02/10/14 14:36, Jan Beulich wrote:
> There's no reason to use the "hardware_domain" variable anywhere here,
> making the code more cumbersome to read.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
> --- a/xen/arch/x86/domain_build.c
> +++ b/xen/arch/x86/domain_build.c
> @@ -270,7 +270,7 @@ static unsigned long __init compute_dom0
>      return nr_pages;
>  }
>  
> -static void __init process_dom0_ioports_disable(void)
> +static void __init process_dom0_ioports_disable(struct domain *dom0)
>  {
>      unsigned long io_from, io_to;
>      char *t, *s = opt_dom0_ioports_disable;
> @@ -303,7 +303,7 @@ static void __init process_dom0_ioports_
>          printk("Disabling dom0 access to ioport range %04lx-%04lx\n",
>              io_from, io_to);
>  
> -        if ( ioports_deny_access(hardware_domain, io_from, io_to) != 0 )
> +        if ( ioports_deny_access(dom0, io_from, io_to) != 0 )
>              BUG();
>      }
>  }
> @@ -1425,29 +1425,28 @@ int __init construct_dom0(
>      rc = 0;
>  
>      /* 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);
> +    rc |= ioports_permit_access(d, 0, 0xFFFF);
> +    rc |= iomem_permit_access(d, 0UL, ~0UL);
> +    rc |= irqs_permit_access(d, 1, nr_irqs_gsi - 1);
>  
>      /*
>       * Modify I/O port access permissions.
>       */
>      /* Master Interrupt Controller (PIC). */
> -    rc |= ioports_deny_access(hardware_domain, 0x20, 0x21);
> +    rc |= ioports_deny_access(d, 0x20, 0x21);
>      /* Slave Interrupt Controller (PIC). */
> -    rc |= ioports_deny_access(hardware_domain, 0xA0, 0xA1);
> +    rc |= ioports_deny_access(d, 0xA0, 0xA1);
>      /* Interval Timer (PIT). */
> -    rc |= ioports_deny_access(hardware_domain, 0x40, 0x43);
> +    rc |= ioports_deny_access(d, 0x40, 0x43);
>      /* PIT Channel 2 / PC Speaker Control. */
> -    rc |= ioports_deny_access(hardware_domain, 0x61, 0x61);
> +    rc |= ioports_deny_access(d, 0x61, 0x61);
>      /* ACPI PM Timer. */
>      if ( pmtmr_ioport )
> -        rc |= ioports_deny_access(hardware_domain, pmtmr_ioport,
> -		                          pmtmr_ioport + 3);
> +        rc |= ioports_deny_access(d, pmtmr_ioport, pmtmr_ioport + 3);
>      /* PCI configuration space (NB. 0xcf8 has special treatment). */
> -    rc |= ioports_deny_access(hardware_domain, 0xcfc, 0xcff);
> +    rc |= ioports_deny_access(d, 0xcfc, 0xcff);
>      /* Command-line I/O ranges. */
> -    process_dom0_ioports_disable();
> +    process_dom0_ioports_disable(d);
>  
>      /*
>       * Modify I/O memory access permissions.
> @@ -1456,22 +1455,22 @@ int __init construct_dom0(
>      if ( mp_lapic_addr != 0 )
>      {
>          mfn = paddr_to_pfn(mp_lapic_addr);
> -        rc |= iomem_deny_access(hardware_domain, mfn, mfn);
> +        rc |= iomem_deny_access(d, 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(hardware_domain, mfn, mfn);
> +            rc |= iomem_deny_access(d, mfn, mfn);
>      }
>      /* MSI range. */
> -    rc |= iomem_deny_access(hardware_domain, paddr_to_pfn(MSI_ADDR_BASE_LO),
> +    rc |= iomem_deny_access(d, 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(hardware_domain, paddr_to_pfn(0xfdULL << 32),
> +        rc |= iomem_deny_access(d, paddr_to_pfn(0xfdULL << 32),
>                                  paddr_to_pfn((1ULL << 40) - 1));
>  
>      /* Remove access to E820_UNUSABLE I/O regions above 1MB. */
> @@ -1483,7 +1482,7 @@ int __init construct_dom0(
>          if ( (e820.map[i].type == E820_UNUSABLE) &&
>               (e820.map[i].size != 0) &&
>               (sfn <= efn) )
> -            rc |= iomem_deny_access(hardware_domain, sfn, efn);
> +            rc |= iomem_deny_access(d, sfn, efn);
>      }
>  
>      BUG_ON(rc != 0);
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel


[-- Attachment #1.2: Type: text/html, Size: 5328 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-02 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02 13:36 [PATCH] x86: favor function parameter over global in construct_dom0() Jan Beulich
2014-10-02 13:46 ` Tim Deegan
2014-10-02 15:11 ` Konrad Rzeszutek Wilk
2014-10-02 15:17   ` Jan Beulich
2014-10-02 15:19 ` Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).