[PATCH 2/2] hv: move the define of MAX_IR_ENTRIES to offline tool


chenli.wei
 

There is an issue of calculate 2^n roundup of CONFIG_MAX_PT_IRQ_ENTRIE,
and the code style is very ugly when we use macro to fix it.

So this patch move MAX_IR_ENTRIE to offline tool which could do align
check and calculate it automatically.

Signed-off-by: Chenli Wei <chenli.wei@...>
---
hypervisor/include/arch/x86/asm/vtd.h | 7 -------
1 file changed, 7 deletions(-)

diff --git a/hypervisor/include/arch/x86/asm/vtd.h b/hypervisor/include/arch/x86/asm/vtd.h
index 4d3518286..284fc62db 100644
--- a/hypervisor/include/arch/x86/asm/vtd.h
+++ b/hypervisor/include/arch/x86/asm/vtd.h
@@ -42,13 +42,6 @@
#define DMAR_ICS_REG 0x9cU /* Invalidation complete status register */
#define DMAR_IRTA_REG 0xb8U /* Interrupt remapping table addr register */

-/* Make sure all PT IRQs work w/ interrupt remapping or post interrupt */
-#if (CONFIG_MAX_PT_IRQ_ENTRIES <= 256)
-#define MAX_IR_ENTRIES 256
-#else
-#define MAX_IR_ENTRIES powerof2_roundup(CONFIG_MAX_PT_IRQ_ENTRIES)
-#endif
-
/* Values for entry_type in ACPI_DMAR_DEVICE_SCOPE - device types */
enum acpi_dmar_scope_type {
ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
--
2.17.1


Geoffroy Van Cutsem
 

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of chenli.wei
Sent: Friday, May 13, 2022 12:29 pm
To: Mao, Junjie <junjie.mao@...>; Li, Fei1 <fei1.li@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: [acrn-dev] [PATCH 2/2] hv: move the define of MAX_IR_ENTRIES to
offline tool

There is an issue of calculate 2^n roundup of CONFIG_MAX_PT_IRQ_ENTRIE,
CONFIG_MAX_PT_IRQ_ENTRIE -> CONFIG_MAX_PT_IRQ_ENTRIES

and the code style is very ugly when we use macro to fix it.

So this patch move MAX_IR_ENTRIE to offline tool which could do align check
MAX_IR_ENTRIE -> MAX_IR_ENTRIES

and calculate it automatically.

Signed-off-by: Chenli Wei <chenli.wei@...>
---
hypervisor/include/arch/x86/asm/vtd.h | 7 -------
1 file changed, 7 deletions(-)

diff --git a/hypervisor/include/arch/x86/asm/vtd.h
b/hypervisor/include/arch/x86/asm/vtd.h
index 4d3518286..284fc62db 100644
--- a/hypervisor/include/arch/x86/asm/vtd.h
+++ b/hypervisor/include/arch/x86/asm/vtd.h
@@ -42,13 +42,6 @@
#define DMAR_ICS_REG 0x9cU /* Invalidation complete status register */
#define DMAR_IRTA_REG 0xb8U /* Interrupt remapping table addr
register */

-/* Make sure all PT IRQs work w/ interrupt remapping or post interrupt */ -
#if (CONFIG_MAX_PT_IRQ_ENTRIES <= 256) -#define MAX_IR_ENTRIES 256 -
#else -#define MAX_IR_ENTRIES
powerof2_roundup(CONFIG_MAX_PT_IRQ_ENTRIES)
-#endif
-
/* Values for entry_type in ACPI_DMAR_DEVICE_SCOPE - device types */
enum acpi_dmar_scope_type {
ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
--
2.17.1





chenli.wei
 

On 5/13/2022 8:34 PM, Geoffroy Van Cutsem wrote:

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of chenli.wei
Sent: Friday, May 13, 2022 12:29 pm
To: Mao, Junjie <junjie.mao@...>; Li, Fei1 <fei1.li@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: [acrn-dev] [PATCH 2/2] hv: move the define of MAX_IR_ENTRIES to
offline tool

There is an issue of calculate 2^n roundup of CONFIG_MAX_PT_IRQ_ENTRIE,
CONFIG_MAX_PT_IRQ_ENTRIE -> CONFIG_MAX_PT_IRQ_ENTRIES
OK

and the code style is very ugly when we use macro to fix it.

So this patch move MAX_IR_ENTRIE to offline tool which could do align check
MAX_IR_ENTRIE -> MAX_IR_ENTRIES
Done, thanks

and calculate it automatically.

Signed-off-by: Chenli Wei <chenli.wei@...>
---
hypervisor/include/arch/x86/asm/vtd.h | 7 -------
1 file changed, 7 deletions(-)

diff --git a/hypervisor/include/arch/x86/asm/vtd.h
b/hypervisor/include/arch/x86/asm/vtd.h
index 4d3518286..284fc62db 100644
--- a/hypervisor/include/arch/x86/asm/vtd.h
+++ b/hypervisor/include/arch/x86/asm/vtd.h
@@ -42,13 +42,6 @@
#define DMAR_ICS_REG 0x9cU /* Invalidation complete status register */
#define DMAR_IRTA_REG 0xb8U /* Interrupt remapping table addr
register */

-/* Make sure all PT IRQs work w/ interrupt remapping or post interrupt */ -
#if (CONFIG_MAX_PT_IRQ_ENTRIES <= 256) -#define MAX_IR_ENTRIES 256 -
#else -#define MAX_IR_ENTRIES
powerof2_roundup(CONFIG_MAX_PT_IRQ_ENTRIES)
-#endif
-
/* Values for entry_type in ACPI_DMAR_DEVICE_SCOPE - device types */
enum acpi_dmar_scope_type {
ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
--
2.17.1







Eddie Dong
 

Once you removed this, you can also remove ROUND2/4/8 MACROs.

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of chenli.wei
Sent: Friday, May 13, 2022 3:29 AM
To: Mao, Junjie <junjie.mao@...>; Li, Fei1 <fei1.li@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: [acrn-dev] [PATCH 2/2] hv: move the define of MAX_IR_ENTRIES to
offline tool

There is an issue of calculate 2^n roundup of CONFIG_MAX_PT_IRQ_ENTRIE,
and the code style is very ugly when we use macro to fix it.

So this patch move MAX_IR_ENTRIE to offline tool which could do align
check and calculate it automatically.

Signed-off-by: Chenli Wei <chenli.wei@...>
---
hypervisor/include/arch/x86/asm/vtd.h | 7 -------
1 file changed, 7 deletions(-)

diff --git a/hypervisor/include/arch/x86/asm/vtd.h
b/hypervisor/include/arch/x86/asm/vtd.h
index 4d3518286..284fc62db 100644
--- a/hypervisor/include/arch/x86/asm/vtd.h
+++ b/hypervisor/include/arch/x86/asm/vtd.h
@@ -42,13 +42,6 @@
#define DMAR_ICS_REG 0x9cU /* Invalidation complete status register
*/
#define DMAR_IRTA_REG 0xb8U /* Interrupt remapping table addr
register */

-/* Make sure all PT IRQs work w/ interrupt remapping or post interrupt */ -
#if (CONFIG_MAX_PT_IRQ_ENTRIES <= 256) -#define MAX_IR_ENTRIES 256 -
#else -#define MAX_IR_ENTRIES
powerof2_roundup(CONFIG_MAX_PT_IRQ_ENTRIES)
-#endif
-
/* Values for entry_type in ACPI_DMAR_DEVICE_SCOPE - device types */
enum acpi_dmar_scope_type {
ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
--
2.17.1





chenli.wei
 

On 5/14/2022 1:13 AM, Eddie Dong wrote:
Once you removed this, you can also remove ROUND2/4/8 MACROs.
OK

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of chenli.wei
Sent: Friday, May 13, 2022 3:29 AM
To: Mao, Junjie <junjie.mao@...>; Li, Fei1 <fei1.li@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: [acrn-dev] [PATCH 2/2] hv: move the define of MAX_IR_ENTRIES to
offline tool

There is an issue of calculate 2^n roundup of CONFIG_MAX_PT_IRQ_ENTRIE,
and the code style is very ugly when we use macro to fix it.

So this patch move MAX_IR_ENTRIE to offline tool which could do align
check and calculate it automatically.

Signed-off-by: Chenli Wei <chenli.wei@...>
---
hypervisor/include/arch/x86/asm/vtd.h | 7 -------
1 file changed, 7 deletions(-)

diff --git a/hypervisor/include/arch/x86/asm/vtd.h
b/hypervisor/include/arch/x86/asm/vtd.h
index 4d3518286..284fc62db 100644
--- a/hypervisor/include/arch/x86/asm/vtd.h
+++ b/hypervisor/include/arch/x86/asm/vtd.h
@@ -42,13 +42,6 @@
#define DMAR_ICS_REG 0x9cU /* Invalidation complete status register
*/
#define DMAR_IRTA_REG 0xb8U /* Interrupt remapping table addr
register */

-/* Make sure all PT IRQs work w/ interrupt remapping or post interrupt */ -
#if (CONFIG_MAX_PT_IRQ_ENTRIES <= 256) -#define MAX_IR_ENTRIES 256 -
#else -#define MAX_IR_ENTRIES
powerof2_roundup(CONFIG_MAX_PT_IRQ_ENTRIES)
-#endif
-
/* Values for entry_type in ACPI_DMAR_DEVICE_SCOPE - device types */
enum acpi_dmar_scope_type {
ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
--
2.17.1