qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"BALATON Zoltan" <balaton@eik.bme.hu>
Cc: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Cédric Le Goater" <clg@redhat.com>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	qemu-ppc@nongnu.org, "Eduardo Habkost" <eduardo@habkost.net>,
	"Alexander Graf" <agraf@csgraf.de>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH 0/3] hw/boards: Remove MachineState::usb_disabled field
Date: Tue, 27 May 2025 19:19:20 +0200	[thread overview]
Message-ID: <c7218963-6e04-41ff-85b5-dfa1e106eb56@redhat.com> (raw)
In-Reply-To: <649e4c91-fb4c-4cb2-9810-b1ee885ffea3@linaro.org>

On 5/26/25 16:20, Philippe Mathieu-Daudé wrote:
> On 26/5/25 15:18, BALATON Zoltan wrote:
>> On Mon, 26 May 2025, Philippe Mathieu-Daudé wrote:
>>> Only add default devices checking defaults_enabled().
>>> Remove the unused usb_disabled field in MachineState.
>>
>> At least for Mac machines this may be more complex. I think there is a 
>> - usb switch to enable/disable USB independently of defaults and due 
>> to some bugs some MacOS versions may need this to boot so maybe it's 
>> used.
> 
> If the user asks -usb off, we shouldn't re-enable it in the shadow.

And if the user asks -usb on, you shouldn't disable it.  My
understanding is that adding

-        if (!has_adb || machine_arch == ARCH_MAC99_U3) {
+        if ((!has_adb || machine_arch == ARCH_MAC99_U3) && defaults_enabled()) {

disables USB completely when -nodefaults.

If you want to remove usb_disabled, change machine->usb to ON_OFF_AUTO
and query

static inline bool machine_usb_enabled(MachineState *ms)
{
         return (defaults_enabled()
                 ? machine->usb != ON_OFF_AUTO_OFF
                 : machine->usb == ON_OFF_AUTO_ON);
}

instead of machine->usb (even better, change the name of the field so that
it causes a compilation error).

Paolo



      parent reply	other threads:[~2025-05-27 17:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-26 13:00 [PATCH 0/3] hw/boards: Remove MachineState::usb_disabled field Philippe Mathieu-Daudé
2025-05-26 13:00 ` [PATCH 1/3] hw/ppc/spapr: Only create default devices when requested Philippe Mathieu-Daudé
2025-05-26 13:00 ` [PATCH 2/3] hw/ppc/mac_newworld: " Philippe Mathieu-Daudé
2025-05-26 13:00 ` [PATCH 3/3] hw/boards: Remove MachineState::usb_disabled field Philippe Mathieu-Daudé
2025-05-26 13:01 ` [PATCH 0/3] " Philippe Mathieu-Daudé
2025-05-26 13:18 ` BALATON Zoltan
2025-05-26 14:20   ` Philippe Mathieu-Daudé
2025-05-27 17:19     ` Paolo Bonzini
2025-05-27 19:59       ` [PATCH 0/3] hw/boards: Remove field Mark Cave-Ayland
2025-05-27 17:19     ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7218963-6e04-41ff-85b5-dfa1e106eb56@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@csgraf.de \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=clg@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=harshpb@linux.ibm.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=npiggin@gmail.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=wangyanan55@huawei.com \
    --cc=zhao1.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).