diff mbox

fixup! pc: add 'etc/boot-cpus' fw_cfg file for machine with more than 255 CPUs

Message ID 20161020185148.GJ5057@thinpad.lan.raisama.net
State New
Headers show

Commit Message

Eduardo Habkost Oct. 20, 2016, 6:51 p.m. UTC
On Thu, Oct 20, 2016 at 04:58:42PM +0200, Igor Mammedov wrote:
> Currently firmware uses 1 byte at 0x5F offset in RTC CMOS
> to get number of CPUs present at boot. However 1 byte is
> not enough to handle more than 255 CPUs.  So add a new
> fw_cfg file that would allow QEMU to tell it.
> For compat reasons add file only for machine types that
> support more than 255 CPUs.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>

I suggest squashing this into the patch, to clarify why we are
setting it to 0.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/pc.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Igor Mammedov Oct. 21, 2016, 8:53 a.m. UTC | #1
On Thu, 20 Oct 2016 16:51:48 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> On Thu, Oct 20, 2016 at 04:58:42PM +0200, Igor Mammedov wrote:
> > Currently firmware uses 1 byte at 0x5F offset in RTC CMOS
> > to get number of CPUs present at boot. However 1 byte is
> > not enough to handle more than 255 CPUs.  So add a new
> > fw_cfg file that would allow QEMU to tell it.
> > For compat reasons add file only for machine types that
> > support more than 255 CPUs.
> > 
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>  
> 
> I suggest squashing this into the patch, to clarify why we are
> setting it to 0.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Could you squash it in while merging series?

> ---
>  hw/i386/pc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index c6f6747..a03b384 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1225,6 +1225,10 @@ static void pc_build_feature_control_file(PCMachineState *pcms)
>  static void rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count)
>  {
>      if (cpus_count > 0xff) {
> +        /* If the number of CPUs can't be represented in 8 bits, the
> +         * BIOS must use "etc/boot-cpus". Set RTC field to 0 just
> +         * to make old BIOSes fail more predictably.
> +         */
>          rtc_set_memory(rtc, 0x5f, 0);
>      } else {
>          rtc_set_memory(rtc, 0x5f, cpus_count - 1);
Eduardo Habkost Oct. 21, 2016, 11:41 a.m. UTC | #2
On Fri, Oct 21, 2016 at 10:53:27AM +0200, Igor Mammedov wrote:
> On Thu, 20 Oct 2016 16:51:48 -0200
> Eduardo Habkost <ehabkost@redhat.com> wrote:
> 
> > On Thu, Oct 20, 2016 at 04:58:42PM +0200, Igor Mammedov wrote:
> > > Currently firmware uses 1 byte at 0x5F offset in RTC CMOS
> > > to get number of CPUs present at boot. However 1 byte is
> > > not enough to handle more than 255 CPUs.  So add a new
> > > fw_cfg file that would allow QEMU to tell it.
> > > For compat reasons add file only for machine types that
> > > support more than 255 CPUs.
> > > 
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>  
> > 
> > I suggest squashing this into the patch, to clarify why we are
> > setting it to 0.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> 
> Could you squash it in while merging series?

I will do.
Michael S. Tsirkin Oct. 27, 2016, 10:08 p.m. UTC | #3
On Fri, Oct 21, 2016 at 10:53:27AM +0200, Igor Mammedov wrote:
> On Thu, 20 Oct 2016 16:51:48 -0200
> Eduardo Habkost <ehabkost@redhat.com> wrote:
> 
> > On Thu, Oct 20, 2016 at 04:58:42PM +0200, Igor Mammedov wrote:
> > > Currently firmware uses 1 byte at 0x5F offset in RTC CMOS
> > > to get number of CPUs present at boot. However 1 byte is
> > > not enough to handle more than 255 CPUs.  So add a new
> > > fw_cfg file that would allow QEMU to tell it.
> > > For compat reasons add file only for machine types that
> > > support more than 255 CPUs.
> > > 
> > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>  
> > 
> > I suggest squashing this into the patch, to clarify why we are
> > setting it to 0.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> 
> Could you squash it in while merging series?

I'm not sure who's merging it (Eduardo do you want to?)
if me, I'd rather  see a clean repost, with a squash and acks
included.

> > ---
> >  hw/i386/pc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index c6f6747..a03b384 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1225,6 +1225,10 @@ static void pc_build_feature_control_file(PCMachineState *pcms)
> >  static void rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count)
> >  {
> >      if (cpus_count > 0xff) {
> > +        /* If the number of CPUs can't be represented in 8 bits, the
> > +         * BIOS must use "etc/boot-cpus". Set RTC field to 0 just
> > +         * to make old BIOSes fail more predictably.
> > +         */
> >          rtc_set_memory(rtc, 0x5f, 0);
> >      } else {
> >          rtc_set_memory(rtc, 0x5f, cpus_count - 1);
Eduardo Habkost Oct. 28, 2016, 12:53 a.m. UTC | #4
On Fri, Oct 28, 2016 at 01:08:32AM +0300, Michael S. Tsirkin wrote:
> On Fri, Oct 21, 2016 at 10:53:27AM +0200, Igor Mammedov wrote:
> > On Thu, 20 Oct 2016 16:51:48 -0200
> > Eduardo Habkost <ehabkost@redhat.com> wrote:
> > 
> > > On Thu, Oct 20, 2016 at 04:58:42PM +0200, Igor Mammedov wrote:
> > > > Currently firmware uses 1 byte at 0x5F offset in RTC CMOS
> > > > to get number of CPUs present at boot. However 1 byte is
> > > > not enough to handle more than 255 CPUs.  So add a new
> > > > fw_cfg file that would allow QEMU to tell it.
> > > > For compat reasons add file only for machine types that
> > > > support more than 255 CPUs.
> > > > 
> > > > Signed-off-by: Igor Mammedov <imammedo@redhat.com>  
> > > 
> > > I suggest squashing this into the patch, to clarify why we are
> > > setting it to 0.
> > > 
> > > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > 
> > Could you squash it in while merging series?
> 
> I'm not sure who's merging it (Eduardo do you want to?)
> if me, I'd rather  see a clean repost, with a squash and acks
> included.

It's already merged. See commit
080ac219cc7d9c55adf925c3545b7450055ad625.
diff mbox

Patch

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c6f6747..a03b384 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1225,6 +1225,10 @@  static void pc_build_feature_control_file(PCMachineState *pcms)
 static void rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count)
 {
     if (cpus_count > 0xff) {
+        /* If the number of CPUs can't be represented in 8 bits, the
+         * BIOS must use "etc/boot-cpus". Set RTC field to 0 just
+         * to make old BIOSes fail more predictably.
+         */
         rtc_set_memory(rtc, 0x5f, 0);
     } else {
         rtc_set_memory(rtc, 0x5f, cpus_count - 1);