From patchwork Fri Feb 23 12:43:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903259 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XqA6kKvO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8t83Bylz23pm for ; Fri, 23 Feb 2024 23:47:28 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUwl-0005e5-Ft; Fri, 23 Feb 2024 07:46:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuZ-0000Zg-Sz for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuW-0003t8-8E for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nmdruoOJ3jUMHKvsYKs+fkt0NIhjHctBauqY59pHvn0=; b=XqA6kKvOkejYO7Hlsc3Lcc9o3+BHMJdZQe+7TcXT4rkwj7DaVvTDnU+d6SSZqKvJGrSh4h SwVqNA90uNMq0eXQyQR1Z+XuXOULn2S/lrw24XY2gl5S2iw7Z9EooObVTpWPpEx4Tlscg1 /fO+A5IQIq8JpMzX19/HUfwxdX9mJ3Q= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-618-j730JWsfP024p31zW5VvBw-1; Fri, 23 Feb 2024 07:44:13 -0500 X-MC-Unique: j730JWsfP024p31zW5VvBw-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-33d29de76abso364989f8f.3 for ; Fri, 23 Feb 2024 04:44:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692249; x=1709297049; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nmdruoOJ3jUMHKvsYKs+fkt0NIhjHctBauqY59pHvn0=; b=LBXHTc2lficUFRItxAfLMiQlln57cwUkZgW1xQ+0MNQ/wTIyB0c1NmKGZTBZ2JrEZ3 rIZ6cMAu9eXJ4KInNb0076vqVAPl3jQocPTjpjciIKZpTeGS8KxcVwPumeF7/u0zriMd NF1Otz3slIn8qrxpl/bBo7BQRiJcSpUYXBE4XfiUdsHg3TfupVNPZ/NWxcDsI5DpgVhJ C0Z8C3jVjfgZ+CFRSGyc8nmVR3NuaxH9dY59NIxVlbmLr4pB6psOiCE2faKVPTfu2vD7 w8ZH5HiC15+rm3B6l5lnxrHVXnF6ep/Uw4ccWyjLtiTMW6F6MvZfImjgPwaKzNrzyoxV LP2Q== X-Gm-Message-State: AOJu0YyQ2gMFR7mrxMgN5PkqX3dwa+w+MSsIwRGPEadCLVAkNcZO/acV OgF802ct6triR/LXXQhmoi8WXirQj7od1H9FR83nbTAvWHI58JjcV1PCmNZDQJGVakTrp/5b5o4 92F0qqBFuvYrlZnH/gsLJDP+hDLGVgtEw3gEwQsb4ngEnPfqCt1J55F/WSiHwrjGB9ZCn6Lb+XF 3WVwnj7+viEsG/GcBChrXo5uEVrrNFxHvuz6gr X-Received: by 2002:adf:e789:0:b0:33d:3566:b5bf with SMTP id n9-20020adfe789000000b0033d3566b5bfmr1544993wrm.14.1708692249505; Fri, 23 Feb 2024 04:44:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiqCArlJLvxhdQSUt8htugF3kvNrFnTJKBD7V2o8ZTh0EgcyIuQEaYZDinViuc8Txv0ns4mg== X-Received: by 2002:adf:e789:0:b0:33d:3566:b5bf with SMTP id n9-20020adfe789000000b0033d3566b5bfmr1544975wrm.14.1708692249107; Fri, 23 Feb 2024 04:44:09 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id cl1-20020a5d5f01000000b0033cdf1f15e8sm2994931wrb.16.2024.02.23.04.44.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:08 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 01/10] acpi, qom: move object_resolve_type_unambiguous to core QOM Date: Fri, 23 Feb 2024 13:43:57 +0100 Message-ID: <20240223124406.234509-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org object_resolve_type_unambiguous provides a useful functionality, that is currently emulated for example by usb_bus_find(). Move it to core code and add error reporting for increased generality. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- include/qom/object.h | 13 +++++++++++++ hw/i386/acpi-build.c | 19 ++++--------------- qom/object.c | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index afccd24ca7a..e9ed9550f05 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1550,6 +1550,19 @@ Object *object_resolve_path(const char *path, bool *ambiguous); Object *object_resolve_path_type(const char *path, const char *typename, bool *ambiguous); +/** + * object_resolve_type_unambiguous: + * @typename: the type to look for + * @errp: pointer to error object + * + * Return the only object in the QOM tree of type @typename. + * If no match or more than one match is found, an error is + * returned. + * + * Returns: The matched object or NULL on path lookup failure. + */ +Object *object_resolve_type_unambiguous(const char *typename, Error **errp); + /** * object_resolve_path_at: * @parent: the object in which to resolve the path diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d3ce96dd9f9..4b47dbfd71c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -192,21 +192,10 @@ static void init_common_fadt_data(MachineState *ms, Object *o, *data = fadt; } -static Object *object_resolve_type_unambiguous(const char *typename) -{ - bool ambig; - Object *o = object_resolve_path_type("", typename, &ambig); - - if (ambig || !o) { - return NULL; - } - return o; -} - static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) { - Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM); - Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE); + Object *piix = object_resolve_type_unambiguous(TYPE_PIIX4_PM, NULL); + Object *lpc = object_resolve_type_unambiguous(TYPE_ICH9_LPC_DEVICE, NULL); Object *obj = piix ? piix : lpc; QObject *o; pm->cpu_hp_io_base = 0; @@ -1428,8 +1417,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm, AcpiMiscInfo *misc, Range *pci_hole, Range *pci_hole64, MachineState *machine) { - Object *i440fx = object_resolve_type_unambiguous(TYPE_I440FX_PCI_HOST_BRIDGE); - Object *q35 = object_resolve_type_unambiguous(TYPE_Q35_HOST_DEVICE); + Object *i440fx = object_resolve_type_unambiguous(TYPE_I440FX_PCI_HOST_BRIDGE, NULL); + Object *q35 = object_resolve_type_unambiguous(TYPE_Q35_HOST_DEVICE, NULL); CrsRangeEntry *entry; Aml *dsdt, *sb_scope, *scope, *dev, *method, *field, *pkg, *crs; CrsRangeSet crs_range_set; diff --git a/qom/object.c b/qom/object.c index 2c4c64d2b63..d4a001cf411 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2229,6 +2229,22 @@ Object *object_resolve_path_at(Object *parent, const char *path) return object_resolve_abs_path(parent, parts, TYPE_OBJECT); } +Object *object_resolve_type_unambiguous(const char *typename, Error **errp) +{ + bool ambig; + Object *o = object_resolve_path_type("", typename, &ambig); + + if (ambig) { + error_setg(errp, "More than one object of type %s", typename); + return NULL; + } + if (!o) { + error_setg(errp, "No object found of type %s", typename); + return NULL; + } + return o; +} + typedef struct StringProperty { char *(*get)(Object *, Error **); From patchwork Fri Feb 23 12:43:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903255 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iybIt1S0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8q95mtLz23d2 for ; Fri, 23 Feb 2024 23:44:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUuy-0000rw-Fs; Fri, 23 Feb 2024 07:44:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUub-0000fZ-QS for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuZ-0003tG-WF for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yHJ+bDYLHMfaCuWzDjl8prnLt3zHpetqgQVOwKkrobE=; b=iybIt1S0JZ/GRZFaHSU6+e7OKVwJfMWr+lLyZHCgfdAqk0DoaU33nK+hXq9dUa8ra+9zzO Z7f9cNyWAniNUAGSQ4QyTxZECH1iAP9BGLad2UZFjh90FE3qjRNIxVCtSy0ytClXtIijwW dH41jEC/4NOtH1vF8Us5yt64JiDkzsQ= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-577-Hz0VthGlMKGMEM1-F1vsVA-1; Fri, 23 Feb 2024 07:44:15 -0500 X-MC-Unique: Hz0VthGlMKGMEM1-F1vsVA-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-33d782af89eso351700f8f.0 for ; Fri, 23 Feb 2024 04:44:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692254; x=1709297054; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yHJ+bDYLHMfaCuWzDjl8prnLt3zHpetqgQVOwKkrobE=; b=kfM1G1IkOVFcD0ySqE7G3qSDV0zd/OKG+PltJdSIBRwaiWPIYmC0BxIBQtxv2XmBqI nPDXX1bRmUohOvBCOD/vglKYPYo+0yHI71fhXNZE02tMeH7edBHN/bn811HC2/HPmyv2 rmCLRVc22VJ1mGALCn+H70ZyQSFe/xcceUVNJARAgGCRlDuwSs0LILleWYmyhWLxEJie WB2ho72TL2KqTOqVvRvprlhT7+rMrcKfM3012M2XpkXvvinkEnn3LqDqPIUW+aQC3DKj jbC76RpSDzuq9YN2tbBRo5eMgtcrhxLfwyKXZaWE6jWFDPGqumlcGbpvYvnvPI24JPcz Yq4Q== X-Gm-Message-State: AOJu0Ywc95++p8VurAbYDPu7FAXq1HTRDcSaXlZXV+zj6WfJe2ILoeJX 0ANm6AStDf/gQ25az2wFRy2SV3nVGRMg6LPVlCmTdCv2ixWZvYPnbmOidJZY3OHHNbjRKdt5sMw +8jM5vn4sUFypbTzEClNkQIL820QA2S3gdO4EFU9MyvHXLYRhpZP0tCqrZzzde1goZDzKA0Ft6e /6wva4NIr44W7npMzJfrjqfmt1B5HrQxYg8BBk X-Received: by 2002:a5d:640f:0:b0:33d:3c58:7c56 with SMTP id z15-20020a5d640f000000b0033d3c587c56mr1626992wru.54.1708692253954; Fri, 23 Feb 2024 04:44:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1O0IwO5farjCJOZ8blbXbSJ5gAHpstrrV7o5FT3ao5La8xddeuJ+QC1cbPZ/iXZ932ZpdNQ== X-Received: by 2002:a5d:640f:0:b0:33d:3c58:7c56 with SMTP id z15-20020a5d640f000000b0033d3c587c56mr1626975wru.54.1708692253655; Fri, 23 Feb 2024 04:44:13 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id h15-20020a05600016cf00b0033da933b250sm2245600wrf.5.2024.02.23.04.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 02/10] ppc: sam460ex: do not use usb_bus_find() Date: Fri, 23 Feb 2024 13:43:58 +0100 Message-ID: <20240223124406.234509-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org usb_bus_find() is always used with argument -1; it can be replaced with a search of the single USB bus on the machine. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth --- hw/ppc/sam460ex.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 1e615b8d355..4d5655ab6b4 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -273,6 +273,7 @@ static void sam460ex_init(MachineState *machine) DeviceState *uic[4]; int i; PCIBus *pci_bus; + USBBus *usb_bus; PowerPCCPU *cpu; CPUPPCState *env; I2CBus *i2c; @@ -420,8 +421,9 @@ static void sam460ex_init(MachineState *machine) sysbus_realize_and_unref(sbdev, &error_fatal); sysbus_mmio_map(sbdev, 0, 0x4bffd0000); sysbus_connect_irq(sbdev, 0, qdev_get_gpio_in(uic[2], 30)); - usb_create_simple(usb_bus_find(-1), "usb-kbd"); - usb_create_simple(usb_bus_find(-1), "usb-mouse"); + usb_bus = USB_BUS(object_resolve_type_unambiguous(TYPE_USB_BUS, &error_abort)); + usb_create_simple(usb_bus, "usb-kbd"); + usb_create_simple(usb_bus, "usb-mouse"); /* PCIe buses */ dev = qdev_new(TYPE_PPC460EX_PCIE_HOST); From patchwork Fri Feb 23 12:43:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MIbTTm1f; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8qJ1bX3z23pn for ; Fri, 23 Feb 2024 23:45:00 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUv5-00010H-Fx; Fri, 23 Feb 2024 07:44:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUud-0000fn-DD for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUub-0003tc-UP for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HLIJwMQykn2L6I9vYNiaAjV57GAq+AzK2swjE7KZHkg=; b=MIbTTm1fSBbR/kDwyuofhjcvE8nk3UYFZ9Bgu9tAVWQsd9JsZuS8ban8AELZdr8TMHjNyc YjxiF2yCqyJP2SjEnFdMtZOiYU4DahX3jZJtTaZNQQ5Oh6BDi3mgT+zPI00ECWygBAwnFn VPijL9LI8N8GgDHNKXt+DP4Twhlx7h8= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-NTp9x-weN2OUN-8E-QgVZg-1; Fri, 23 Feb 2024 07:44:19 -0500 X-MC-Unique: NTp9x-weN2OUN-8E-QgVZg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-33d4c09ec04so458203f8f.0 for ; Fri, 23 Feb 2024 04:44:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692257; x=1709297057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HLIJwMQykn2L6I9vYNiaAjV57GAq+AzK2swjE7KZHkg=; b=GdAGBcQX1jqQ5rNeAPj6SfpgI+5J6aD5PKAsxDHdNGMJIs8br0FcvDVcuPolH82idd ymTqMzCDmdNMcTCq1RqMpqLIfSPJirOOr49FN8dXDePi74gpMdGEXTghzGeC0jMfTuU0 n4edGmHiAM5Vj2AkwHs57D4x2SCUmads5jaBM3jRDo236owI4oeS/ZssSvDkZLQN/Mqz g3ibJnA3xbyOhiDTOfN3P3SjzKpIUbrj8LQZpk1UoKEoLntTRIcyHm0oUUy3qK5DCINp 3DkNtLrlSP/rwSkyaCHUd1GCVWO7qSnNLbESbX4Q005334I4c4YJ8Whnl1CAum+i5FtL QlPg== X-Gm-Message-State: AOJu0YyZDtCAmjk8aScrjNODn7QsI7a3v5JaqFj2lCKEJV9FrY4o8dnB rV+4uS/xHg2INwEV40ck1WUW9Sa9nPCcbyPtIZhz1iuqc89j7np5tOBhSaURegS/9zidYX9C+sB q2F5fC3w4fKHFUn+PzjodEUXWjx8I0EuJhgVJ3tgddSceHth8AUXBnhfMF1Ev+G75+Y1/7gZB9f eW5+albk+fsPwV6mVhW3TEHiUomaDgmi8cPfrP X-Received: by 2002:a5d:4a06:0:b0:33d:47c4:fbb3 with SMTP id m6-20020a5d4a06000000b0033d47c4fbb3mr1339305wrq.65.1708692257233; Fri, 23 Feb 2024 04:44:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdaEFF2W0YaTJSSFxp5TPBI1+zxYk7W2YedWW5RAii4ZqSkh0c8QaceJU1gD+loMluipTxjg== X-Received: by 2002:a5d:4a06:0:b0:33d:47c4:fbb3 with SMTP id m6-20020a5d4a06000000b0033d47c4fbb3mr1339291wrq.65.1708692256897; Fri, 23 Feb 2024 04:44:16 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id ay16-20020a5d6f10000000b0033da4f601c9sm2650332wrb.55.2024.02.23.04.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:14 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 03/10] sh4: r2d: do not use usb_bus_find() Date: Fri, 23 Feb 2024 13:43:59 +0100 Message-ID: <20240223124406.234509-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org usb_bus_find() is always used with argument -1; it can be replaced with a search of the single USB bus on the machine. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth --- hw/sh4/r2d.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index c73e8f49b8a..4d34ad00d93 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -244,6 +244,7 @@ static void r2d_init(MachineState *machine) SysBusDevice *busdev; MemoryRegion *address_space_mem = get_system_memory(); PCIBus *pci_bus; + USBBus *usb_bus; cpu = SUPERH_CPU(cpu_create(machine->cpu_type)); env = &cpu->env; @@ -312,7 +313,8 @@ static void r2d_init(MachineState *machine) pci_init_nic_devices(pci_bus, mc->default_nic); /* USB keyboard */ - usb_create_simple(usb_bus_find(-1), "usb-kbd"); + usb_bus = USB_BUS(object_resolve_type_unambiguous(TYPE_USB_BUS, &error_abort)); + usb_create_simple(usb_bus, "usb-kbd"); /* Todo: register on board registers */ memset(&boot_params, 0, sizeof(boot_params)); From patchwork Fri Feb 23 12:44:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903257 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LJeqnH/6; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8qT1k02z23pm for ; Fri, 23 Feb 2024 23:45:09 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUv3-00010A-S7; Fri, 23 Feb 2024 07:44:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuh-0000hZ-DA for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuf-0003tu-RB for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PbisCKnnZebt0o4X5xYHZ/NyWPkyeznjN5JGV4Gvo+s=; b=LJeqnH/62tYGdrZmz9u6NykD4jvRFWcXq3ukqVEq96t54BF8fyUH8233zhorLOcbLhwsF7 5mtzf5blxQPnqlbwh5eVTFoRt77PoZib8PVtu3kC9YRlYQb8o0Hvk5Fay12fB6mcHNf55W 0/gjOaY7BskdzfhS3sgzdTUWdoNeroU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-631-eGiuqqP3OZygJLI8_5hs3w-1; Fri, 23 Feb 2024 07:44:23 -0500 X-MC-Unique: eGiuqqP3OZygJLI8_5hs3w-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-33d782add49so293081f8f.2 for ; Fri, 23 Feb 2024 04:44:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692260; x=1709297060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PbisCKnnZebt0o4X5xYHZ/NyWPkyeznjN5JGV4Gvo+s=; b=GYdlJwiYzYtK6x8HPuH3ty6vGGRvmKJfQjM8UYQy+FEIfidb2PH3B4PaDO3vHo0qn1 Pts9D309ihvHcc+3AUEp7APBrs+otB7boBkgSXUTzXrdnSMuItAkNkvBHxZNNtRW54hr Mpe7ykkYCXbcA7twYtqCe436GWnS3H/2lJtnU7ksJNQ7J28w19jNOltEf2XINIiMiYM5 PGMAAxmcdx190ZHlfqWHqVFzO/xUmN8ixDhXIxpXe+2NQbLxmp4B/09DAeUFEeK0bGA2 ghpNCVvBjbYLS9mmpMehN15I/t6pB94GapYG6GZIqKP+5JwAJR/3BNHUih3dSBAtpcuE PkZg== X-Gm-Message-State: AOJu0YxjFGR84cGVthG5Ee10UDbKTXa1yVPZe5zl0zyJlFBT0pADMcDr AfURaH1SICqHdfsFXfCGUkwoHU9mchRCXt1gICTauKXOvk1VUOTgUgoUwJtobIh0smSKqeIv+Fv eVqLsRUeXthS6VAKE+qSlBgh+4o6nbffuEZ5K6VI6GpVemM/qlcBS8WfNFE8FxrJEw57wXkemAt UFNoXUeB+SHj0nMAwpBlmNohCetUiq7Jw4dWYM X-Received: by 2002:a5d:68c8:0:b0:33d:1352:3dcc with SMTP id p8-20020a5d68c8000000b0033d13523dccmr1240310wrw.35.1708692260367; Fri, 23 Feb 2024 04:44:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGe0d0tPctkR+DgQEeWJbMgH4kW86kTsKvAX+QsatP6gJjyf59gAyAK/xMtkdqIy5PR5r7Kwg== X-Received: by 2002:a5d:68c8:0:b0:33d:1352:3dcc with SMTP id p8-20020a5d68c8000000b0033d13523dccmr1240298wrw.35.1708692260046; Fri, 23 Feb 2024 04:44:20 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id co22-20020a0560000a1600b0033db0c866f7sm982711wrb.11.2024.02.23.04.44.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 04/10] mips/loongson3_virt: do not require CONFIG_USB Date: Fri, 23 Feb 2024 13:44:00 +0100 Message-ID: <20240223124406.234509-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Once the Kconfig for hw/mips is cleaned up, it will be possible to build a binary that does not include any USB host controller and therefore that does not include the code guarded by CONFIG_USB. While the simpler creation functions such as usb_create_simple can be inlined, this is not true of usb_bus_find(). Remove it, replacing it with a search of the single USB bus created by loongson3_virt_devices_init(). Signed-off-by: Paolo Bonzini --- hw/mips/loongson3_virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index caedde2df00..b2a8b22b4ea 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -447,8 +447,9 @@ static inline void loongson3_virt_devices_init(MachineState *machine, if (defaults_enabled() && object_class_by_name("pci-ohci")) { pci_create_simple(pci_bus, -1, "pci-ohci"); - usb_create_simple(usb_bus_find(-1), "usb-kbd"); - usb_create_simple(usb_bus_find(-1), "usb-tablet"); + Object *usb_bus = object_resolve_type_unambiguous(TYPE_USB_BUS, &error_abort); + usb_create_simple(USB_BUS(usb_bus), "usb-kbd"); + usb_create_simple(USB_BUS(usb_bus), "usb-tablet"); } pci_init_nic_devices(pci_bus, mc->default_nic); From patchwork Fri Feb 23 12:44:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ey1TkBP4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8v31Cl5z23pm for ; Fri, 23 Feb 2024 23:48:15 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUxo-0007Ji-J7; Fri, 23 Feb 2024 07:47:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuj-0000iY-Ub for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUui-0003u5-Fm for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KX5mFYyzGrbXN9qLjuG0MCdCO6Thw7ipfGXYojSpuyc=; b=Ey1TkBP4w2pFEOR3t8SoEoWwyt5j/eUZhOPugpsyPOPrkVGj7CLDUQB/d5i2jw4zXLF2RH w4t/1jl7eOBMjMe6BFXCENtx2BQI0s8+9bdeFl9iAyyotkMuYS1fIe08M3CgqRZu7UY0K/ KkKGNPSL5SG7TctinTWvwc+Sv2JJztY= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-LXKv0L9uPYaASjDm13dvyQ-1; Fri, 23 Feb 2024 07:44:26 -0500 X-MC-Unique: LXKv0L9uPYaASjDm13dvyQ-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2d25a02f48fso6416781fa.3 for ; Fri, 23 Feb 2024 04:44:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692263; x=1709297063; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KX5mFYyzGrbXN9qLjuG0MCdCO6Thw7ipfGXYojSpuyc=; b=Co4u29jEQRRVujpUpQSYgAkDc8z0ukgh9dl2x+zJ/5hvCqq4sW6zXnlItEaMXfpfty 8q6fRmSCl7ZdY0jHtyngUti7CO14WrDgfKvNAnsByGxKvL2ol4irJPaKWJ+bYajfQAME Htx4O09nnFRHJ5v9x7sU/xoQjdSntem7/1QiGdrLa/GBZYGTuTqu8H8+fVC3eTxzZ4tY Du4Ag29kpZCJTHlwK7ce9mBOtmqcCltLLtDOUpgvW2vwnn5jwFbANzgKDAJYQRsJXaOO +FpZ32+EnKmrvMBMX6s+a7GCA0PrGM5hDRgZiK/mvzCI5bfCPIph3W1tnVnvO4Eg1CBd +g9g== X-Gm-Message-State: AOJu0YyugBwHxEtvWlHD1oGFfOIWTu2eq8v7cmFOulq6w40p82XbCXn2 pJn486XP+DaCQSeslmf2jbAwQ2nuix6PB+ppM/6IIc3a7OoegT9rdan+Qs6KQpd53a44uVLiptU 1TABju9DvOdRKkX3VxyO47a5zl6BgIRgtYRm4x2vmJBzVTzyTDaoL812jM1yLxXcVU2SjulFcqR rLTOjVY3KOj41TgFJq4OzzkIrH0ZdlGRwrC+EG X-Received: by 2002:a2e:7c13:0:b0:2d2:4fa4:f4b2 with SMTP id x19-20020a2e7c13000000b002d24fa4f4b2mr1181114ljc.28.1708692263686; Fri, 23 Feb 2024 04:44:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IESCRktr+2eQ1mc6e1iEHnu9EoSdBhBHSEHa+T8BhbcHfs/921+ZhKU3wa6u08IThcw5VZRkw== X-Received: by 2002:a2e:7c13:0:b0:2d2:4fa4:f4b2 with SMTP id x19-20020a2e7c13000000b002d24fa4f4b2mr1181100ljc.28.1708692263222; Fri, 23 Feb 2024 04:44:23 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id m6-20020a7bce06000000b00410bca333b7sm2219456wmc.27.2024.02.23.04.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:20 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 05/10] hppa: do not require CONFIG_USB Date: Fri, 23 Feb 2024 13:44:01 +0100 Message-ID: <20240223124406.234509-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org With --without-default-devices it is possible to build a binary that does not include any USB host controller and therefore that does not include the code guarded by CONFIG_USB. While the simpler creation functions such as usb_create_simple can be inlined, this is not true of usb_bus_find(). Remove it, replacing it with a search of the single USB bus on the machine. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- hw/hppa/machine.c | 7 ++++--- hw/hppa/Kconfig | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 5fcaf5884be..11982d5776c 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -396,10 +396,11 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* create USB OHCI controller for USB keyboard & mouse on Astro machines */ - if (!lasi_dev && machine->enable_graphics) { + if (!lasi_dev && machine->enable_graphics && defaults_enabled()) { pci_create_simple(pci_bus, -1, "pci-ohci"); - usb_create_simple(usb_bus_find(-1), "usb-kbd"); - usb_create_simple(usb_bus_find(-1), "usb-mouse"); + Object *usb_bus = object_resolve_type_unambiguous(TYPE_USB_BUS, &error_abort); + usb_create_simple(USB_BUS(usb_bus), "usb-kbd"); + usb_create_simple(USB_BUS(usb_bus), "usb-mouse"); } /* register power switch emulation */ diff --git a/hw/hppa/Kconfig b/hw/hppa/Kconfig index dff5df7f725..ee7ffd2bfb5 100644 --- a/hw/hppa/Kconfig +++ b/hw/hppa/Kconfig @@ -2,6 +2,7 @@ config HPPA_B160L bool imply PCI_DEVICES imply E1000_PCI + imply USB_OHCI_PCI imply VIRTIO_VGA select ASTRO select DINO @@ -17,4 +18,3 @@ config HPPA_B160L select LASIPS2 select PARALLEL select ARTIST - select USB_OHCI_PCI From patchwork Fri Feb 23 12:44:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903263 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Lng8j+Df; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8tz7512z23pn for ; Fri, 23 Feb 2024 23:48:11 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUxo-0007K2-RS; Fri, 23 Feb 2024 07:47:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUun-0000mj-RV for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuk-0003uO-Dv for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7f1rYsUVXVWM9aVY7w8eUmrIaIbBx6X0kUvj6Xvo3iY=; b=Lng8j+DfgopdYSQxT1CM+fLyrhj7iSYyZWbXfVuUb0Ych2CMYMGZbftKRJNwGRmrEr+ugF 80mSlyOss53qfcFrj9Vb6Od3faAj8N8Y2fc2lPG0BSpRPwSmuOWSL9siDrl/8z/JYJOwiI 9W+P1v9lDeOfSFHiKY8GxmZE5ZTVX0o= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-388-7vgVU-OhNp-FaJY7vEIt4Q-1; Fri, 23 Feb 2024 07:44:28 -0500 X-MC-Unique: 7vgVU-OhNp-FaJY7vEIt4Q-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-33d51bb9353so363777f8f.2 for ; Fri, 23 Feb 2024 04:44:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692266; x=1709297066; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7f1rYsUVXVWM9aVY7w8eUmrIaIbBx6X0kUvj6Xvo3iY=; b=G2AG9BB9ElZTJVSM6Flqu3qjwTCd3+In0SkIDxIVDCA06eGy2aB0UQYtHzs3DAVvO6 mugyUOO0mhap6141RsTyitfMfW0cmtdzGwQ0fHGMh+H5W57b3rZpI3j9TKkotvEHF1YZ DtTCQ9LdRmZZh0APStQ5JadCFKMh3qj2hRuSgpRq4CsHXwWmRbS4nmDDa+yjwC5VxSKZ JQvycgLSNFYNsEon6vOd+tr+zyyUai1y6gJVvdIQ5LLVtEdWAfHfSgl9gRFaOgGVobhV L2j9oC5Q2LCxV0aSpQPGGg5YLUpjG8lJ6glz8BfCVUgEesacPgcg7im9AoyOPVXNpQIK 7QCw== X-Gm-Message-State: AOJu0Ywb8p471BPT+coduvd5I6E1HWc5pzfFXeEQ5oVidQBpO+TMHWQA eAifjPYVc/jSMxZoBMG+K+UlW3rjG7QPbs4IvVl/xqsXJYfQcYIty98fbwE5TJWdC2nRO/jFfoO xuqMlnU5ouig84Kb9fstyzXv4/OcL0KqpEdEr1F347pcbvmOIkGbHeF5sDNBaf8GgVwGPJE7S96 rAuVfLTJZL10hJRkuf6Y4qDtnzBlRbeKKqxCow X-Received: by 2002:adf:e789:0:b0:33d:3566:b5bf with SMTP id n9-20020adfe789000000b0033d3566b5bfmr1545605wrm.14.1708692266772; Fri, 23 Feb 2024 04:44:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9HiiapX5Ydb8YEpnBoLAATyy/JkywlvMQJDQx/gvppnw/04bZvrl4m7Mk8QcOo5Vmj3iheA== X-Received: by 2002:adf:e789:0:b0:33d:3566:b5bf with SMTP id n9-20020adfe789000000b0033d3566b5bfmr1545592wrm.14.1708692266523; Fri, 23 Feb 2024 04:44:26 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id m4-20020adff384000000b0033cfa00e497sm2797729wro.64.2024.02.23.04.44.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 06/10] mac_newworld: do not require CONFIG_USB Date: Fri, 23 Feb 2024 13:44:02 +0100 Message-ID: <20240223124406.234509-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org With --without-default-devices it should not be required to have devices in the binary that are removed by -nodefaults. It should be therefore possible to build a binary that does not include any USB host controller or any of the code guarded by CONFIG_USB. While the simpler creation functions such as usb_create_simple can be inlined, this is not true of usb_bus_find(). Remove it, replacing it with a search of the single USB bus on the machine. With this change, it is possible to change "select USB_OHCI_PCI" into an "imply" directive. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- hw/ppc/mac_newworld.c | 7 +++---- hw/ppc/Kconfig | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index b36dbaf2b68..4efebab66b4 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -431,10 +431,9 @@ static void ppc_core99_init(MachineState *machine) /* U3 needs to use USB for input because Linux doesn't support via-cuda on PPC64 */ if (!has_adb || machine_arch == ARCH_MAC99_U3) { - USBBus *usb_bus = usb_bus_find(-1); - - usb_create_simple(usb_bus, "usb-kbd"); - usb_create_simple(usb_bus, "usb-mouse"); + Object *usb_bus = object_resolve_type_unambiguous(TYPE_USB_BUS, &error_abort); + usb_create_simple(USB_BUS(usb_bus), "usb-kbd"); + usb_create_simple(USB_BUS(usb_bus), "usb-mouse"); } } diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index 44263a58c4d..9841c2c9690 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -116,13 +116,13 @@ config MAC_NEWWORLD imply PCI_DEVICES imply SUNGEM imply TEST_DEVICES + imply USB_OHCI_PCI select ADB select MACIO select MACIO_GPIO select MAC_PMU select UNIN_PCI select FW_CFG_PPC - select USB_OHCI_PCI config E500 bool From patchwork Fri Feb 23 12:44:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RrmFS3hI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8tV1472z23pm for ; Fri, 23 Feb 2024 23:47:46 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUwl-0005e7-Fn; Fri, 23 Feb 2024 07:46:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUur-0000ob-SL for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUun-0003ub-ST for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wdFeJfFPd+rESlH0Stf2Q7C2WzvaU7Ne4mFpQgmpfoM=; b=RrmFS3hI7BfhZkgdGJdgihNwbeKE0Ma+hgDkXjO3yx3im/8R7iS9Gs+hjJTLEA0gmc/9TX mp+9Kdh9Fn3/+AibmKvoHME1HhiwWEwKdgpmWj1v5dT4oNSK2wIN7GxMaWFSB2hWWKnm2S q8FNT5eKca4Dru4bNBWdShKn0hnTvms= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-353-Ae52FGZxO_29WQSjnxE78g-1; Fri, 23 Feb 2024 07:44:32 -0500 X-MC-Unique: Ae52FGZxO_29WQSjnxE78g-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-33d23c8694dso130694f8f.1 for ; Fri, 23 Feb 2024 04:44:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692270; x=1709297070; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wdFeJfFPd+rESlH0Stf2Q7C2WzvaU7Ne4mFpQgmpfoM=; b=t3BcvK3zIkO4rssli860QT2lff3A4hpPdKCtWFJaY9r+77DAxHfSSDmzVaRuZIzidA FAJLCb1MdRD2eJVCF2n6KXlLdNdbw6FTbtJ7tIPHTa8vINUA+engp598MGXEAMa4CuE7 /VPb9UTbfhjUuSt+569L6wuXaRfVavGBsKSmbeeAMbNbpJOZTKVaeKBVnkVKr67Yx5pH fSxtGewBoPqNNJP2zubBIip94oxYsACALs876WS3mwtPF0RyaKi1rIb/3jPDnPuHqCcB sNU36F1VWaFi/dRr13mHhetH3ccnQcA36RTVigYuHvUt10ez82j1mfDFH2AtJbXtLCSB RBFg== X-Gm-Message-State: AOJu0Yw0MHvvFODUY/hOWyZLofKRalPfgEv20DKMT2BzLdAwG6DJ2Gpo quS7d/7pVB3NVPRq0fV0DXcIXVXsTO3WhKo87cek4pyvu4vDDN7QjeL3GhnIG7y9cKMpUL5urDd RsxGHtVBe/NbWsT5WHuzoM3MvhA1FG8fzPpxrtxapELKsd7HYdxkhYFgdjdgdj//r8sVYjCBzeu 9lX6kzCdrwcTWPcG9WWYkPY750tDQnKm7a9zAu X-Received: by 2002:a5d:4206:0:b0:33b:636e:c967 with SMTP id n6-20020a5d4206000000b0033b636ec967mr1294125wrq.1.1708692269924; Fri, 23 Feb 2024 04:44:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFS0LU2NZ6+ixSSAqdRDaqXiQKZUgk7K7RMRwoMbR7rTgMASC/o2VDWNaw0NVSYvNF9nkBHzg== X-Received: by 2002:a5d:4206:0:b0:33b:636e:c967 with SMTP id n6-20020a5d4206000000b0033b636ec967mr1294110wrq.1.1708692269551; Fri, 23 Feb 2024 04:44:29 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id v9-20020a05600c444900b0041228b2e179sm2262252wmn.39.2024.02.23.04.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:27 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 07/10] pseries: do not require CONFIG_USB Date: Fri, 23 Feb 2024 13:44:03 +0100 Message-ID: <20240223124406.234509-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org With --without-default-devices it is possible to build a binary that does not include any USB host controller and therefore that does not include the code guarded by CONFIG_USB. While the simpler creation functions such as usb_create_simple can be inlined, this is not true of usb_bus_find(). Remove it, replacing it with a search of the single USB bus on the machine. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- hw/ppc/spapr.c | 7 +++---- hw/ppc/Kconfig | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0d72d286d80..44d339982da 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3024,10 +3024,9 @@ static void spapr_machine_init(MachineState *machine) } if (has_vga) { - USBBus *usb_bus = usb_bus_find(-1); - - usb_create_simple(usb_bus, "usb-kbd"); - usb_create_simple(usb_bus, "usb-mouse"); + Object *usb_bus = object_resolve_type_unambiguous(TYPE_USB_BUS, &error_abort); + usb_create_simple(USB_BUS(usb_bus), "usb-kbd"); + usb_create_simple(USB_BUS(usb_bus), "usb-mouse"); } } diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index 9841c2c9690..d497fa2b825 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -1,5 +1,6 @@ config PSERIES bool + imply USB_OHCI_PCI imply PCI_DEVICES imply TEST_DEVICES imply VIRTIO_VGA From patchwork Fri Feb 23 12:44:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aAg+iBZT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8tP585Fz23pm for ; Fri, 23 Feb 2024 23:47:41 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUwu-0005fm-I4; Fri, 23 Feb 2024 07:46:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuu-0000r0-PE for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuq-0003uo-4G for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6xocwLyBkw11u09+Yx+wnt0tbL1R8DbbnKCk16lnu+c=; b=aAg+iBZTmFYvbiKYaWsBIChYObE9nMQkc6VRuTbGdXB6VCUCz+ENh0D7jo0A38TjvkhoMU ILO7e78KQyuk3nH00yo/ZKzDoFU2LUi3OjKF2OUyZy76rxJ+ASiVQw8eca6eOgeqI6DqVG 6dr+H+PrhqbUvvnn6cjUgnpskz2hp4Y= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-435-amNMiNwcNlm_sFHti_nxyQ-1; Fri, 23 Feb 2024 07:44:34 -0500 X-MC-Unique: amNMiNwcNlm_sFHti_nxyQ-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-33d11878726so151226f8f.0 for ; Fri, 23 Feb 2024 04:44:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692272; x=1709297072; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6xocwLyBkw11u09+Yx+wnt0tbL1R8DbbnKCk16lnu+c=; b=JY4H63chSuN0tVZ/GjNiMuZvuF+bxb6lvAAmxRLqPum9nBer1YyihacFRl7yJynvKy A7UKSKQ1WrxA8CAoRTfBk2dRXBSnlObNLyemo6ilONzQYTLoavbFJQg4vUsuZkwWU48z +4kZzhrbN8VUGRXdHpguqq3PkptKJb6u+ahQJ02JtJlZHOanA2ihgT21McuFQBUOz+hs kockgYtmYTGuWuK/B7GqoHpGmeVsb50dVgteJWzF159Az2jPZcaolTv5k/nmShQ+NpT5 NdAgNi1Q9JJZAOdb2UGQ7BztrfwiyVa7nISMktc8Topw+Q9LRCKmdYqS4jpbHcFpLm57 fYbg== X-Gm-Message-State: AOJu0Yzsov6CaJW/Vq501F1XBUEFvS/K4P8BHbuKh646zE5EEDD5NvIQ cl3kNk95PP2bLnVmETBYN6kUg1XHCccWXeGL8WLdwUJUDCooSWxxAi8NcD8ZW0GNDkHHSh18OBr 2C1LTody6+TZmDFyVM4Xh0SyOZ2uuG1x3aUmBbnjwnC8lVhleSCoyeBuylZe5ZcUUMMZcrjZpCr 7yhT+IPJQzsRTD4+5m/DDSOq9D42cORoD3seRk X-Received: by 2002:adf:f511:0:b0:33d:6bd3:9e28 with SMTP id q17-20020adff511000000b0033d6bd39e28mr1208229wro.70.1708692272303; Fri, 23 Feb 2024 04:44:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGy1FDbIczoEV6HKRUyBgvdGYK3IcfHpgqyvOFFYwCFyYgBakQel3X9zAOz5YEEPxJ3bHXgLA== X-Received: by 2002:adf:f511:0:b0:33d:6bd3:9e28 with SMTP id q17-20020adff511000000b0033d6bd39e28mr1208218wro.70.1708692271998; Fri, 23 Feb 2024 04:44:31 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id z11-20020adfe54b000000b0033da18b05f2sm2676512wrm.32.2024.02.23.04.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:30 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 08/10] usb: remove usb_bus_find Date: Fri, 23 Feb 2024 13:44:04 +0100 Message-ID: <20240223124406.234509-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Inline the sole remaining use, which is for the -usbdevice command line. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- include/hw/usb.h | 1 - hw/usb/bus.c | 15 +-------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/include/hw/usb.h b/include/hw/usb.h index cfeead28403..d46d96779ad 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -498,7 +498,6 @@ struct USBBusOps { void usb_bus_new(USBBus *bus, size_t bus_size, USBBusOps *ops, DeviceState *host); void usb_bus_release(USBBus *bus); -USBBus *usb_bus_find(int busnr); void usb_legacy_register(const char *typename, const char *usbdevice_name, USBDevice *(*usbdevice_init)(void)); USBDevice *usbdevice_create(const char *cmdline); diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 76fda41b7ec..796769fadb4 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -100,19 +100,6 @@ void usb_bus_release(USBBus *bus) QTAILQ_REMOVE(&busses, bus, next); } -USBBus *usb_bus_find(int busnr) -{ - USBBus *bus; - - if (-1 == busnr) - return QTAILQ_FIRST(&busses); - QTAILQ_FOREACH(bus, &busses, next) { - if (bus->busnr == busnr) - return bus; - } - return NULL; -} - static void usb_device_realize(USBDevice *dev, Error **errp) { USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev); @@ -643,7 +630,7 @@ HumanReadableText *qmp_x_query_usb(Error **errp) /* handle legacy -usbdevice cmd line option */ USBDevice *usbdevice_create(const char *driver) { - USBBus *bus = usb_bus_find(-1 /* any */); + USBBus *bus = QTAILQ_FIRST(&busses); LegacyUSBFactory *f = NULL; Error *err = NULL; GSList *i; From patchwork Fri Feb 23 12:44:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903258 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cGiWc9Fk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8sX1Rgcz23pm for ; Fri, 23 Feb 2024 23:46:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUwu-0005fo-I3; Fri, 23 Feb 2024 07:46:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuv-0000r7-3k for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUus-0003v4-M4 for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u1Am5sp9Le7YOg3uMyFUE5fw0vwzFtnOClC84CQOA8c=; b=cGiWc9FkoWDHx2t6jbAHvYceUSbHzoU8+o9HnOoXnLzSfprIm3rlDZQomlUsDwizR3vPAW kVAcCzpdfkkPK4TeiwUoehD06h/wrRk7W3brN6t0Gtd/gCGtOaIKWQcIbgah86B/dlfDzr jzhuO9+98cRCgwgVrFfby2IRnNOA9HY= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-eNDPJYk1N1O9r_5NGCK6BA-1; Fri, 23 Feb 2024 07:44:36 -0500 X-MC-Unique: eNDPJYk1N1O9r_5NGCK6BA-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-33d07c0825aso135806f8f.2 for ; Fri, 23 Feb 2024 04:44:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692274; x=1709297074; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u1Am5sp9Le7YOg3uMyFUE5fw0vwzFtnOClC84CQOA8c=; b=FxXZF8L8rTK6KoUoVS4iOikf4I0wk2E6+xuNz5EVX4kocVaeLUIuhVyH8U+fBwpa+R hlP2ou7+6f2ukz2mvo4o61D7WNqWgJo9VYFGAR4ilOItCMZEeQOrgnYNBCfU3d/yaLeI izKpKKCGkFMh1jXfC6lgA55V3l7DmkV8dCPRb942v5qSAFL8XbqQDaeXCQQyUfXWk0ub g282Bo6UQde+rlKXZdAygzIbYMZgGeffhfh4sqSczXkWHupHHlCL1gZvXWGsrDrKKv0z 7ahs8cbmwZGXzzU26CvDpKKqE+7RSBc7991gDpYQIrtRb7kHNcmSDy+aIDOvkTzxSvna UpqQ== X-Gm-Message-State: AOJu0Yw/xztg7t67SKiVE6ZqrKV7wz3W9QOfVBtKiMBzJ65JHWnqgGxY 7HYeiu5W3yqdN5AyJIQ8UNsVGO3qnP9pkZpxuMu9g9ZRyWeVCl7nnxiXp3r7719S52288Npu/Y+ NW++NgVZcqZmS7sg9VVvV2ke3ZQ0lvtGKkFddVADrdouQeFYZFFVeNEvl09XeA5PAXD/S9GY56m lgZBnn7JywXB6WGHMRDZaC/nZlRorP5To+MADb X-Received: by 2002:a5d:5149:0:b0:33d:6554:e1f9 with SMTP id u9-20020a5d5149000000b0033d6554e1f9mr1418137wrt.50.1708692274641; Fri, 23 Feb 2024 04:44:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMqhEWqMsdXAlAhQ4efGPGxJ4VMWHCJq5ogZrMg9ssUoCgOmhZT18pBKI0CKyzNNPkYOvl2A== X-Received: by 2002:a5d:5149:0:b0:33d:6554:e1f9 with SMTP id u9-20020a5d5149000000b0033d6554e1f9mr1418120wrt.50.1708692274276; Fri, 23 Feb 2024 04:44:34 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id m4-20020a5d6a04000000b0033ae7d768b2sm2624792wru.117.2024.02.23.04.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:32 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 09/10] usb: extract sysbus-ohci to a separate file Date: Fri, 23 Feb 2024 13:44:05 +0100 Message-ID: <20240223124406.234509-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Split the sysbus version to a separate file so that it is not included in PCI-only machines, and adjust Kconfig for machines that do need sysbus-ohci. The copyrights are based on the time and employer of balrog and Paul Brook's contributions. While adjusting the SM501 dependency, move it to the right place instead of keeping it in the R4D machine. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth --- hw/usb/hcd-ohci-sysbus.c | 91 ++++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-ohci.c | 58 ------------------------ hw/arm/Kconfig | 12 +++-- hw/display/Kconfig | 1 + hw/ppc/Kconfig | 2 +- hw/sh4/Kconfig | 1 - hw/usb/Kconfig | 4 ++ hw/usb/meson.build | 1 + 8 files changed, 105 insertions(+), 65 deletions(-) create mode 100644 hw/usb/hcd-ohci-sysbus.c diff --git a/hw/usb/hcd-ohci-sysbus.c b/hw/usb/hcd-ohci-sysbus.c new file mode 100644 index 00000000000..4e4481232b6 --- /dev/null +++ b/hw/usb/hcd-ohci-sysbus.c @@ -0,0 +1,91 @@ +/* + * QEMU USB OHCI Emulation + * Copyright (c) 2006 Openedhand Ltd. + * Copyright (c) 2010 CodeSourcery + * Copyright (c) 2024 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/irq.h" +#include "qapi/error.h" +#include "qemu/module.h" +#include "qemu/timer.h" +#include "hw/usb.h" +#include "migration/vmstate.h" +#include "hw/sysbus.h" +#include "hw/qdev-dma.h" +#include "hw/qdev-properties.h" +#include "trace.h" +#include "hcd-ohci.h" + + +static void ohci_realize_pxa(DeviceState *dev, Error **errp) +{ + OHCISysBusState *s = SYSBUS_OHCI(dev); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + Error *err = NULL; + + usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, + s->masterbus, s->firstport, + &address_space_memory, ohci_sysbus_die, &err); + if (err) { + error_propagate(errp, err); + return; + } + sysbus_init_irq(sbd, &s->ohci.irq); + sysbus_init_mmio(sbd, &s->ohci.mem); +} + +static void usb_ohci_reset_sysbus(DeviceState *dev) +{ + OHCISysBusState *s = SYSBUS_OHCI(dev); + OHCIState *ohci = &s->ohci; + + ohci_hard_reset(ohci); +} + +static Property ohci_sysbus_properties[] = { + DEFINE_PROP_STRING("masterbus", OHCISysBusState, masterbus), + DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3), + DEFINE_PROP_UINT32("firstport", OHCISysBusState, firstport, 0), + DEFINE_PROP_DMAADDR("dma-offset", OHCISysBusState, dma_offset, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void ohci_sysbus_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->realize = ohci_realize_pxa; + set_bit(DEVICE_CATEGORY_USB, dc->categories); + dc->desc = "OHCI USB Controller"; + device_class_set_props(dc, ohci_sysbus_properties); + dc->reset = usb_ohci_reset_sysbus; +} + +static const TypeInfo ohci_sysbus_info = { + .name = TYPE_SYSBUS_OHCI, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(OHCISysBusState), + .class_init = ohci_sysbus_class_init, +}; + +static void ohci_register_types(void) +{ + type_register_static(&ohci_sysbus_info); +} + +type_init(ohci_register_types) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index d73b53f33c8..fc8fc91a1d1 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1955,31 +1955,6 @@ void ohci_sysbus_die(struct OHCIState *ohci) ohci_bus_stop(ohci); } -static void ohci_realize_pxa(DeviceState *dev, Error **errp) -{ - OHCISysBusState *s = SYSBUS_OHCI(dev); - SysBusDevice *sbd = SYS_BUS_DEVICE(dev); - Error *err = NULL; - - usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, - s->masterbus, s->firstport, - &address_space_memory, ohci_sysbus_die, &err); - if (err) { - error_propagate(errp, err); - return; - } - sysbus_init_irq(sbd, &s->ohci.irq); - sysbus_init_mmio(sbd, &s->ohci.mem); -} - -static void usb_ohci_reset_sysbus(DeviceState *dev) -{ - OHCISysBusState *s = SYSBUS_OHCI(dev); - OHCIState *ohci = &s->ohci; - - ohci_hard_reset(ohci); -} - static const VMStateDescription vmstate_ohci_state_port = { .name = "ohci-core/port", .version_id = 1, @@ -2054,36 +2029,3 @@ const VMStateDescription vmstate_ohci_state = { NULL } }; - -static Property ohci_sysbus_properties[] = { - DEFINE_PROP_STRING("masterbus", OHCISysBusState, masterbus), - DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3), - DEFINE_PROP_UINT32("firstport", OHCISysBusState, firstport, 0), - DEFINE_PROP_DMAADDR("dma-offset", OHCISysBusState, dma_offset, 0), - DEFINE_PROP_END_OF_LIST(), -}; - -static void ohci_sysbus_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - - dc->realize = ohci_realize_pxa; - set_bit(DEVICE_CATEGORY_USB, dc->categories); - dc->desc = "OHCI USB Controller"; - device_class_set_props(dc, ohci_sysbus_properties); - dc->reset = usb_ohci_reset_sysbus; -} - -static const TypeInfo ohci_sysbus_info = { - .name = TYPE_SYSBUS_OHCI, - .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(OHCISysBusState), - .class_init = ohci_sysbus_class_init, -}; - -static void ohci_register_types(void) -{ - type_register_static(&ohci_sysbus_info); -} - -type_init(ohci_register_types) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 29abe1da29c..ffb9041b07f 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -185,7 +185,7 @@ config PXA2XX select SERIAL select SD select SSI - select USB_OHCI + select USB_OHCI_SYSBUS select PCMCIA config GUMSTIX @@ -256,7 +256,7 @@ config REALVIEW select PL310 # cache controller select ARM_SBCON_I2C select DS1338 # I2C RTC+NVRAM - select USB_OHCI + select USB_OHCI_SYSBUS config SBSA_REF bool @@ -337,7 +337,7 @@ config VERSATILE select PL080 # DMA controller select PL190 # Vector PIC select REALVIEW - select USB_OHCI + select USB_OHCI_SYSBUS config VEXPRESS bool @@ -393,6 +393,7 @@ config ALLWINNER_A10 select AXP2XX_PMU select SERIAL select UNIMP + select USB_OHCI_SYSBUS config ALLWINNER_H3 bool @@ -406,7 +407,7 @@ config ALLWINNER_H3 select ARM_TIMER select ARM_GIC select UNIMP - select USB_OHCI + select USB_OHCI_SYSBUS select USB_EHCI_SYSBUS select SD @@ -422,7 +423,7 @@ config ALLWINNER_R40 select ARM_TIMER select ARM_GIC select UNIMP - select USB_OHCI + select USB_OHCI_SYSBUS select USB_EHCI_SYSBUS select SD @@ -528,6 +529,7 @@ config NPCM7XX select SSI select UNIMP select PCA954X + select USB_OHCI_SYSBUS config FSL_IMX25 bool diff --git a/hw/display/Kconfig b/hw/display/Kconfig index 1aafe1923d2..07acb37dc66 100644 --- a/hw/display/Kconfig +++ b/hw/display/Kconfig @@ -77,6 +77,7 @@ config SM501 select I2C select DDC select SERIAL + select USB_OHCI_SYSBUS config TCX bool diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig index d497fa2b825..d49e7847909 100644 --- a/hw/ppc/Kconfig +++ b/hw/ppc/Kconfig @@ -67,7 +67,7 @@ config SAM460EX select SM501 select SMBUS_EEPROM select USB_EHCI_SYSBUS - select USB_OHCI + select USB_OHCI_SYSBUS select FDT_PPC config AMIGAONE diff --git a/hw/sh4/Kconfig b/hw/sh4/Kconfig index ab733a3f760..e0c4ecd1a53 100644 --- a/hw/sh4/Kconfig +++ b/hw/sh4/Kconfig @@ -6,7 +6,6 @@ config R2D select I82378 if TEST_DEVICES select IDE_MMIO select PFLASH_CFI02 - select USB_OHCI_PCI select PCI select SM501 select SH7750 diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig index 0f486764ed6..f569ed7eeaa 100644 --- a/hw/usb/Kconfig +++ b/hw/usb/Kconfig @@ -11,6 +11,10 @@ config USB_OHCI bool select USB +config USB_OHCI_SYSBUS + bool + select USB_OHCI + config USB_OHCI_PCI bool default y if PCI_DEVICES diff --git a/hw/usb/meson.build b/hw/usb/meson.build index 2c13c528785..94f0e3b034d 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -15,6 +15,7 @@ system_ss.add(when: 'CONFIG_USB', if_true: files( system_ss.add(when: 'CONFIG_USB_UHCI', if_true: files('hcd-uhci.c')) system_ss.add(when: 'CONFIG_USB_OHCI', if_true: files('hcd-ohci.c')) system_ss.add(when: 'CONFIG_USB_OHCI_PCI', if_true: files('hcd-ohci-pci.c')) +system_ss.add(when: 'CONFIG_USB_OHCI_SYSBUS', if_true: files('hcd-ohci-sysbus.c')) system_ss.add(when: 'CONFIG_USB_EHCI', if_true: files('hcd-ehci.c')) system_ss.add(when: 'CONFIG_USB_EHCI_PCI', if_true: files('hcd-ehci-pci.c')) system_ss.add(when: 'CONFIG_USB_EHCI_SYSBUS', if_true: files('hcd-ehci.c', 'hcd-ehci-sysbus.c')) From patchwork Fri Feb 23 12:44:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1903266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Qy460FhA; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Th8v462ygz23pm for ; Fri, 23 Feb 2024 23:48:16 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdUxp-0007Kg-3o; Fri, 23 Feb 2024 07:47:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuw-0000sn-3T for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdUuu-0003vG-Jv for qemu-devel@nongnu.org; Fri, 23 Feb 2024 07:44:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708692280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/EEabN0n+ev512MEiobhlaPXaFyHc3L1SDEjqtz9S28=; b=Qy460FhAglq5qgCLwM1xln1oRxLkZIEKB2UxNO2WhhhS8LErPnq71GS9Bj0/tKg5UuqYN4 m7TxN52D69+x+zC4Pcq7RYX5VTHaZLu7nDk5Mt3NAbOypUi7eFf/dLi0S38xApuOZy2YgD stfgo2d0SC786iK3+Xt7WudVOqZhRs4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-245-NPfLpbrsNbuv0N1FvQsBNA-1; Fri, 23 Feb 2024 07:44:38 -0500 X-MC-Unique: NPfLpbrsNbuv0N1FvQsBNA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-41294afc0d4so2392955e9.0 for ; Fri, 23 Feb 2024 04:44:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708692277; x=1709297077; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/EEabN0n+ev512MEiobhlaPXaFyHc3L1SDEjqtz9S28=; b=fPY5mU0/5PVmlnVz9FU2r3kVLh8Uyf3JP41f5i6fdU7PTS5RmLcqdWw3cI6gs4+Id3 U+LQdqjn+ql+Rxwg15gCgcLU4er7Lcik+JjeDD+Bd6acrsWWV1YG8EN9z7DvJiPG5nm+ Uv2MG0gbWcvhshaXKhM2/lekktLDDEHPdqManI42+3aeVRYMh2RZ6fpFf+FLztIDZsTK 7aAeulJNc1P09a37zm/J2jgnjozLLdyaqw24ftknlKleHD9fOyYaQW53r0yJFoezPSo2 rXt+CBPc4Vl2oLRHWh1tCXPVxDK5lZE+qSZp28PwydZhEwzvEOdANxeZiYqk+11cFKQR qwQA== X-Gm-Message-State: AOJu0YxHg9cgOySLYmdeB0H0p9wYioN2Rt5UD7VOfAiWO3Ffqs8mWLR7 THj+asty3de+m58ynSf+IeWOL36Sj/2oh4gxQUZ2pxMUXFQc7AuY1n4pYcZ5YogAeKn6/3Mq9Xy RYY0YNu+KDihW6C/3G5tBhFD/Wvbhrglz15fXDMJlRuaKN3m3+LIAmsaA41lgxNSPK+4X0T0odL lt4pSA0mNTIPaTOhUYavIhbgybfIDCi/N/Z9hc X-Received: by 2002:a05:600c:3109:b0:412:4375:38c1 with SMTP id g9-20020a05600c310900b00412437538c1mr5063265wmo.3.1708692276896; Fri, 23 Feb 2024 04:44:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+BPWz50nYnhH8NdhEh8kCe6VFaGWsD7Pdac02UV7tVNtFuznFu7ZdVsjARKnOkSDHJ65rNQ== X-Received: by 2002:a05:600c:3109:b0:412:4375:38c1 with SMTP id g9-20020a05600c310900b00412437538c1mr5063254wmo.3.1708692276674; Fri, 23 Feb 2024 04:44:36 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id k20-20020a05600c0b5400b004129018510esm2222942wmr.22.2024.02.23.04.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 04:44:34 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: philmd@linaro.org, balaton@eik.bme.hu Subject: [PATCH 10/10] usb: remove duplicate file in system_ss Date: Fri, 23 Feb 2024 13:44:06 +0100 Message-ID: <20240223124406.234509-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240223124406.234509-1-pbonzini@redhat.com> References: <20240223124406.234509-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Because USB_EHCI_SYSBUS selects USB_EHCI, there is no need to include hcd-ehci.c explicitly. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- hw/usb/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/meson.build b/hw/usb/meson.build index 94f0e3b034d..aac3bb35f27 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -18,7 +18,7 @@ system_ss.add(when: 'CONFIG_USB_OHCI_PCI', if_true: files('hcd-ohci-pci.c')) system_ss.add(when: 'CONFIG_USB_OHCI_SYSBUS', if_true: files('hcd-ohci-sysbus.c')) system_ss.add(when: 'CONFIG_USB_EHCI', if_true: files('hcd-ehci.c')) system_ss.add(when: 'CONFIG_USB_EHCI_PCI', if_true: files('hcd-ehci-pci.c')) -system_ss.add(when: 'CONFIG_USB_EHCI_SYSBUS', if_true: files('hcd-ehci.c', 'hcd-ehci-sysbus.c')) +system_ss.add(when: 'CONFIG_USB_EHCI_SYSBUS', if_true: files('hcd-ehci-sysbus.c')) system_ss.add(when: 'CONFIG_USB_XHCI', if_true: files('hcd-xhci.c')) system_ss.add(when: 'CONFIG_USB_XHCI_PCI', if_true: files('hcd-xhci-pci.c')) system_ss.add(when: 'CONFIG_USB_XHCI_SYSBUS', if_true: files('hcd-xhci-sysbus.c'))