Message ID | 1399964954-10842-5-git-send-email-zhen-hual@hp.com |
---|---|
State | New |
Headers | show |
On Tue, May 13, 2014 at 11:09 AM, Li, Zhen-Hua <zhen-hual@hp.com> wrote: > From: "Li, ZhenHua" <zhen-hual@hp.com> > > There is some runtime check for max cpu count. Make them support 4096 cpus. > > Signed-off-by: Li, ZhenHua <zhen-hual@hp.com> > --- > hw/i386/acpi-build.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c > index c98df88..5c3bf10 100644 > --- a/hw/i386/acpi-build.c > +++ b/hw/i386/acpi-build.c [...] > @@ -680,7 +680,7 @@ build_append_notify_method(GArray *device, const char *name, > for (i = 0; i < count; i++) { > GArray *target = build_alloc_array(); > build_append_nameseg(target, format, i); > - assert(i < 256); /* Fits in 1 byte */ > + assert(i < 4096); /* Fits in 1 byte */ The comment is no longer true. Also the function build_append_notify_method is called with format argument set to "CP%0.02X", looks like this should be changed to "CP%0.03X".
Maybe it should be 4 bytes for 4096 (0x1000). On 05/13/2014 04:19 PM, Max Filippov wrote: > On Tue, May 13, 2014 at 11:09 AM, Li, Zhen-Hua <zhen-hual@hp.com> wrote: >> From: "Li, ZhenHua" <zhen-hual@hp.com> >> >> There is some runtime check for max cpu count. Make them support 4096 cpus. >> >> Signed-off-by: Li, ZhenHua <zhen-hual@hp.com> >> --- >> hw/i386/acpi-build.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c >> index c98df88..5c3bf10 100644 >> --- a/hw/i386/acpi-build.c >> +++ b/hw/i386/acpi-build.c > [...] > >> @@ -680,7 +680,7 @@ build_append_notify_method(GArray *device, const char *name, >> for (i = 0; i < count; i++) { >> GArray *target = build_alloc_array(); >> build_append_nameseg(target, format, i); >> - assert(i < 256); /* Fits in 1 byte */ >> + assert(i < 4096); /* Fits in 1 byte */ > The comment is no longer true. > Also the function build_append_notify_method is called with format argument > set to "CP%0.02X", looks like this should be changed to "CP%0.03X". >
On Thu, May 15, 2014 at 11:16 AM, Li, ZhenHua <zhen-hual@hp.com> wrote: > Maybe it should be 4 bytes for 4096 (0x1000). I'd say that 2 bytes should be enough, but actually I don't see why anybody would care in that function how many bytes it is. > On 05/13/2014 04:19 PM, Max Filippov wrote: >> >> On Tue, May 13, 2014 at 11:09 AM, Li, Zhen-Hua <zhen-hual@hp.com> wrote: >>> >>> From: "Li, ZhenHua" <zhen-hual@hp.com> >>> >>> There is some runtime check for max cpu count. Make them support 4096 >>> cpus. >>> >>> Signed-off-by: Li, ZhenHua <zhen-hual@hp.com> >>> --- >>> hw/i386/acpi-build.c | 8 ++++---- >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c >>> index c98df88..5c3bf10 100644 >>> --- a/hw/i386/acpi-build.c >>> +++ b/hw/i386/acpi-build.c >> >> [...] >> >>> @@ -680,7 +680,7 @@ build_append_notify_method(GArray *device, const char >>> *name, >>> for (i = 0; i < count; i++) { >>> GArray *target = build_alloc_array(); >>> build_append_nameseg(target, format, i); BTW, build_append_nameseg also expects format string that makes a string of 4 characters, otherwise it asserts. >>> - assert(i < 256); /* Fits in 1 byte */ >>> + assert(i < 4096); /* Fits in 1 byte */ >> >> The comment is no longer true. >> Also the function build_append_notify_method is called with format >> argument >> set to "CP%0.02X", looks like this should be changed to "CP%0.03X".
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c98df88..5c3bf10 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -272,7 +272,7 @@ static void GCC_FMT_ATTR(2, 3) build_append_nameseg(GArray *array, const char *format, ...) { /* It would be nicer to use g_string_vprintf but it's only there in 2.22 */ - char s[] = "XXXX"; + char s[] = "XXXXXX"; int len; va_list args; @@ -280,7 +280,7 @@ build_append_nameseg(GArray *array, const char *format, ...) len = vsnprintf(s, sizeof s, format, args); va_end(args); - assert(len == 4); + assert(len == 4 || len == 5 || len == 6); g_array_append_vals(array, s, len); } @@ -680,7 +680,7 @@ build_append_notify_method(GArray *device, const char *name, for (i = 0; i < count; i++) { GArray *target = build_alloc_array(); build_append_nameseg(target, format, i); - assert(i < 256); /* Fits in 1 byte */ + assert(i < 4096); /* Fits in 1 byte */ build_append_notify_target_ifequal(method, target, i, 1); build_free_array(target); } @@ -1006,7 +1006,7 @@ build_ssdt(GArray *table_data, GArray *linker, /* The current AML generator can cover the APIC ID range [0..255], * inclusive, for VCPU hotplug. */ - QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256); + QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 4096); g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT); /* Copy header and patch values in the S3_ / S4_ / S5_ packages */