Re: [Xen-devel] [PATCH v4 01/16] arm/x86/common: Add HAS_[ALTERNATIVE|EX_TABLE]

2016-09-19 Thread Konrad Rzeszutek Wilk
> > @@ -42,16 +42,16 @@ config ACPI
> >   Advanced Configuration and Power Interface (ACPI) support for Xen is
> >   an alternative to device tree on ARM64.
> > 
> > -config HAS_GICV3
> > +config HAS_ALTERNATIVE
> > bool
> > 
> > -config ALTERNATIVE
> > +config HAS_GICV3
> > bool
> 
> Why did you invert HAS_GICV3 and HAS_ALTERNATIVE? This makes the patch more
> difficult to read.

To be in alphabetic order. But considering I remove it immediately in
the next patch (as I move it to common/Kconfig) it is kind of pointless. 
> 
> Cheers,
> 
> -- 
> Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 01/16] arm/x86/common: Add HAS_[ALTERNATIVE|EX_TABLE]

2016-09-19 Thread Julien Grall

Hi Konrad,

On 19/09/2016 16:04, Konrad Rzeszutek Wilk wrote:

On Mon, Sep 19, 2016 at 11:26:19AM +0200, Julien Grall wrote:

Hi Konrad,

On 16/09/2016 18:38, Konrad Rzeszutek Wilk wrote:

x86 implements all of them by default - and we just
add two extra HAS_ variables to be declared in autoconf.h.

ARM 64 only has alternative while ARM 32 has none of them.

And while at it change the livepatch common code that
would benefit from this.

Suggested-by: Julien Grall 
Signed-off-by: Konrad Rzeszutek Wilk 

---
Cc: Stefano Stabellini 
Cc: Julien Grall 
Cc: Jan Beulich 
Cc: Andrew Cooper 
Cc: Doug Goldstein 

v2: First submission
v3: Move the config options to common code
Don't include  in the file.
Don't even include  in the file as xen/Rules.mk automatically
includes the config.h for every GCC invocation.
v4: Depend on "arm64: s/ALTERNATIVE/HAS_ALTERNATIVE/"


I can't find this patch on the ML. Did you forget to send it?


Oh darn. Here it is inline:

From 13bc2e2f1082ac72e89c598443781b5141412e9a Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk 
Date: Tue, 13 Sep 2016 12:45:14 -0400
Subject: [PATCH] arm64: s/ALTERNATIVE/HAS_ALTERNATIVE/

No functional change. Also move the entries in the Kconfig file
to be more in alphabetical order.

Suggested-by: Jan Beulich 
Signed-off-by: Konrad Rzeszutek Wilk 
---
Cc: Julien Grall 
Cc: Stefano Stabellini 
Cc: Jan Beulich 
Cc: Andrew Cooper 
Cc: Doug Goldstein 

v4: New submission.
---
 xen/arch/arm/Kconfig  | 8 
 xen/arch/arm/Makefile | 2 +-
 xen/arch/arm/xen.lds.S| 2 +-
 xen/include/asm-arm/alternative.h | 4 ++--
 xen/include/asm-arm/cpuerrata.h   | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 797c91f..b188293 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -12,8 +12,8 @@ config ARM_32
 config ARM_64
def_bool y
depends on 64BIT
+   select HAS_ALTERNATIVE
select HAS_GICV3
-   select ALTERNATIVE

 config ARM
def_bool y
@@ -42,16 +42,16 @@ config ACPI
  Advanced Configuration and Power Interface (ACPI) support for Xen is
  an alternative to device tree on ARM64.

-config HAS_GICV3
+config HAS_ALTERNATIVE
bool

-config ALTERNATIVE
+config HAS_GICV3
bool


Why did you invert HAS_GICV3 and HAS_ALTERNATIVE? This makes the patch 
more difficult to read.


Cheers,

--
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 01/16] arm/x86/common: Add HAS_[ALTERNATIVE|EX_TABLE]

2016-09-19 Thread Konrad Rzeszutek Wilk
On Mon, Sep 19, 2016 at 11:26:19AM +0200, Julien Grall wrote:
> Hi Konrad,
> 
> On 16/09/2016 18:38, Konrad Rzeszutek Wilk wrote:
> > x86 implements all of them by default - and we just
> > add two extra HAS_ variables to be declared in autoconf.h.
> > 
> > ARM 64 only has alternative while ARM 32 has none of them.
> > 
> > And while at it change the livepatch common code that
> > would benefit from this.
> > 
> > Suggested-by: Julien Grall 
> > Signed-off-by: Konrad Rzeszutek Wilk 
> > 
> > ---
> > Cc: Stefano Stabellini 
> > Cc: Julien Grall 
> > Cc: Jan Beulich 
> > Cc: Andrew Cooper 
> > Cc: Doug Goldstein 
> > 
> > v2: First submission
> > v3: Move the config options to common code
> > Don't include  in the file.
> > Don't even include  in the file as xen/Rules.mk 
> > automatically
> > includes the config.h for every GCC invocation.
> > v4: Depend on "arm64: s/ALTERNATIVE/HAS_ALTERNATIVE/"
> 
> I can't find this patch on the ML. Did you forget to send it?

Oh darn. Here it is inline:

From 13bc2e2f1082ac72e89c598443781b5141412e9a Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk 
Date: Tue, 13 Sep 2016 12:45:14 -0400
Subject: [PATCH] arm64: s/ALTERNATIVE/HAS_ALTERNATIVE/

No functional change. Also move the entries in the Kconfig file
to be more in alphabetical order.

Suggested-by: Jan Beulich 
Signed-off-by: Konrad Rzeszutek Wilk 
---
Cc: Julien Grall 
Cc: Stefano Stabellini 
Cc: Jan Beulich 
Cc: Andrew Cooper 
Cc: Doug Goldstein 

v4: New submission.
---
 xen/arch/arm/Kconfig  | 8 
 xen/arch/arm/Makefile | 2 +-
 xen/arch/arm/xen.lds.S| 2 +-
 xen/include/asm-arm/alternative.h | 4 ++--
 xen/include/asm-arm/cpuerrata.h   | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 797c91f..b188293 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -12,8 +12,8 @@ config ARM_32
 config ARM_64
def_bool y
depends on 64BIT
+   select HAS_ALTERNATIVE
select HAS_GICV3
-   select ALTERNATIVE
 
 config ARM
def_bool y
@@ -42,16 +42,16 @@ config ACPI
  Advanced Configuration and Power Interface (ACPI) support for Xen is
  an alternative to device tree on ARM64.
 
-config HAS_GICV3
+config HAS_ALTERNATIVE
bool
 
-config ALTERNATIVE
+config HAS_GICV3
bool
 
 endmenu
 
 menu "ARM errata workaround via the alternative framework"
-   depends on ALTERNATIVE
+   depends on HAS_ALTERNATIVE
 
 config ARM64_ERRATUM_827319
bool "Cortex-A53: 827319: Data cache clean instructions might cause 
overlapping transactions to the interconnect"
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 64fdf41..61e655b 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -4,7 +4,7 @@ subdir-y += platforms
 subdir-$(CONFIG_ARM_64) += efi
 subdir-$(CONFIG_ACPI) += acpi
 
-obj-$(CONFIG_ALTERNATIVE) += alternative.o
+obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o
 obj-y += bootfdt.o
 obj-y += cpu.o
 obj-y += cpuerrata.o
diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 3c5e7ba..47b910d 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -151,7 +151,7 @@ SECTIONS
*(.initcall1.init)
__initcall_end = .;
 
-#ifdef CONFIG_ALTERNATIVE
+#ifdef CONFIG_HAS_ALTERNATIVE
. = ALIGN(4);
__alt_instructions = .;
*(.altinstructions)
diff --git a/xen/include/asm-arm/alternative.h 
b/xen/include/asm-arm/alternative.h
index 9f88fd9..6851217 100644
--- a/xen/include/asm-arm/alternative.h
+++ b/xen/include/asm-arm/alternative.h
@@ -5,7 +5,7 @@
 #include 
 #include 
 
-#ifdef CONFIG_ALTERNATIVE
+#ifdef CONFIG_HAS_ALTERNATIVE
 
 #ifndef __ASSEMBLY__
 
@@ -154,7 +154,7 @@ int apply_alternatives(const struct alt_instr *start, const 
struct alt_instr *en
 #define ALTERNATIVE(oldinstr, newinstr, ...)   \
_ALTERNATIVE_CFG(oldinstr, newinstr, __VA_ARGS__, 1)
 
-#else /* !CONFIG_ALTERNATIVE */
+#else /* !CONFIG_HAS_ALTERNATIVE */
 
 static inline void apply_alternatives_all(void)
 {
diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrata.h
index 5e35b4f..8c57c6a 100644
--- a/xen/include/asm-arm/cpuerrata.h
+++ b/xen/include/asm-arm/cpuerrata.h
@@ -7,7 +7,7 @@
 
 void check_local_cpu_errata(void);
 
-#ifdef CONFIG_ALTERNATIVE
+#ifdef CONFIG_HAS_ALTERNATIVE
 
 #define CHECK_WORKAROUND_HELPER(erratum, feature, arch) \
 static inline bool_t check_workaround_##erratum(void)   \
@@ -27,7 +27,7 @@ static inline bool_t check_workaround_##erratum(void) 
  \
 }

Re: [Xen-devel] [PATCH v4 01/16] arm/x86/common: Add HAS_[ALTERNATIVE|EX_TABLE]

2016-09-19 Thread Julien Grall

Hi Konrad,

On 16/09/2016 18:38, Konrad Rzeszutek Wilk wrote:

x86 implements all of them by default - and we just
add two extra HAS_ variables to be declared in autoconf.h.

ARM 64 only has alternative while ARM 32 has none of them.

And while at it change the livepatch common code that
would benefit from this.

Suggested-by: Julien Grall 
Signed-off-by: Konrad Rzeszutek Wilk 

---
Cc: Stefano Stabellini 
Cc: Julien Grall 
Cc: Jan Beulich 
Cc: Andrew Cooper 
Cc: Doug Goldstein 

v2: First submission
v3: Move the config options to common code
Don't include  in the file.
Don't even include  in the file as xen/Rules.mk automatically
includes the config.h for every GCC invocation.
v4: Depend on "arm64: s/ALTERNATIVE/HAS_ALTERNATIVE/"


I can't find this patch on the ML. Did you forget to send it?

Cheers,

--
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v4 01/16] arm/x86/common: Add HAS_[ALTERNATIVE|EX_TABLE]

2016-09-19 Thread Jan Beulich
>>> On 16.09.16 at 18:38,  wrote:
> x86 implements all of them by default - and we just
> add two extra HAS_ variables to be declared in autoconf.h.
> 
> ARM 64 only has alternative while ARM 32 has none of them.
> 
> And while at it change the livepatch common code that
> would benefit from this.
> 
> Suggested-by: Julien Grall 
> Signed-off-by: Konrad Rzeszutek Wilk 

Relevant parts
Acked-by: Jan Beulich 


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v4 01/16] arm/x86/common: Add HAS_[ALTERNATIVE|EX_TABLE]

2016-09-16 Thread Konrad Rzeszutek Wilk
x86 implements all of them by default - and we just
add two extra HAS_ variables to be declared in autoconf.h.

ARM 64 only has alternative while ARM 32 has none of them.

And while at it change the livepatch common code that
would benefit from this.

Suggested-by: Julien Grall 
Signed-off-by: Konrad Rzeszutek Wilk 

---
Cc: Stefano Stabellini 
Cc: Julien Grall 
Cc: Jan Beulich 
Cc: Andrew Cooper 
Cc: Doug Goldstein 

v2: First submission
v3: Move the config options to common code
Don't include  in the file.
Don't even include  in the file as xen/Rules.mk automatically
includes the config.h for every GCC invocation.
v4: Depend on "arm64: s/ALTERNATIVE/HAS_ALTERNATIVE/"
Remove the extra newline in arch/x86/Kconfig
---
 xen/arch/arm/Kconfig   | 3 ---
 xen/arch/x86/Kconfig   | 2 ++
 xen/common/Kconfig | 6 ++
 xen/common/livepatch.c | 4 +++-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index b188293..2e023d1 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -42,9 +42,6 @@ config ACPI
  Advanced Configuration and Power Interface (ACPI) support for Xen is
  an alternative to device tree on ARM64.
 
-config HAS_ALTERNATIVE
-   bool
-
 config HAS_GICV3
bool
 
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 265fd79..96ca2bf 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -7,8 +7,10 @@ config X86
select ACPI_LEGACY_TABLES_LOOKUP
select COMPAT
select CORE_PARKING
+   select HAS_ALTERNATIVE
select HAS_CPUFREQ
select HAS_EHCI
+   select HAS_EX_TABLE
select HAS_GDBSX
select HAS_IOPORTS
select HAS_KEXEC
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 4331874..81e0017 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -11,9 +11,15 @@ config COMPAT
 config CORE_PARKING
bool
 
+config HAS_ALTERNATIVE
+   bool
+
 config HAS_DEVICE_TREE
bool
 
+config HAS_EX_TABLE
+   bool
+
 config HAS_MEM_ACCESS
bool
 
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 3729409..c9ceeb0 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -638,7 +638,7 @@ static int prepare_payload(struct payload *payload,
   sizeof(*region->frame[i].bugs);
 }
 
-#ifndef CONFIG_ARM
+#ifdef CONFIG_HAS_ALTERNATIVE
 sec = livepatch_elf_sec_by_name(elf, ".altinstructions");
 if ( sec )
 {
@@ -669,7 +669,9 @@ static int prepare_payload(struct payload *payload,
 }
 apply_alternatives(start, end);
 }
+#endif
 
+#ifdef CONFIG_HAS_EX_TABLE
 sec = livepatch_elf_sec_by_name(elf, ".ex_table");
 if ( sec )
 {
-- 
2.5.5


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel