From patchwork Fri Feb 3 14:55:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650076 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863567pva; Fri, 3 Feb 2023 06:58:20 -0800 (PST) X-Google-Smtp-Source: AK7set/MEmYWULHcdtq59Ef+bZu1k69NbmOloFGGg70E+TP9WhkkN5JtRlyZ1u4N8iT+io0lDo6G X-Received: by 2002:ad4:5590:0:b0:536:ba5e:6ac0 with SMTP id f16-20020ad45590000000b00536ba5e6ac0mr13919768qvx.40.1675436300359; Fri, 03 Feb 2023 06:58:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436300; cv=none; d=google.com; s=arc-20160816; b=KpadbOY8q7vdZYLwW2DG7dxHU5OXawV1QrFCEpPMY4L1j/wwYV6dolCbX6fmCELN94 jB9xYhA2OnN6hJ3vZA/vMj+TM6mD9fQiVT9HVCA1unwTlazjXiBj5s8mQUE02WOYa9Cm vAGKKZnp5k2dJalXLHcPw5TcyEa9ZrZykE/Wwc2no4OrrA5ydVyhs6k/2p4b3rwAo08T bwNf6VYxhNN2AffO+dWpT1QNrHU8pSPlGsXLMauMRqylLrkdp76YLloBY6e+xS8RTr75 nyuwYU5633VBYUhyiC+ugTdpz6nKaWxTznAVUFfNKTtjFJleIY96otocyfB5VY0Rf8vg O91w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+umTNh0pbiZOqriKf5LBKbWjyWBQDWdA/pzjCDYec3I=; b=u5Qt91xmpfg3Kkkw/BgIYU9U4GYdhogVmKvN1otILDLR+sQppgeAHMt+EFlIQiWAH5 u1K55y/nQ5F1UZn+OBcV5WgKWr+c0DEgFo8CrHmOoxwdtaSmeb4T9sMb4WZzRMtCzKWp qO2RTOPZf5LW10bOGkNcd2uoeC1Yb7pZNdxU7ZP8RzMpgFLYFdaPdcgP9SWdOExXazdj Fl5SZCLkauTOAtD7b9BN9jV/pJGSQxZRarjViXfJJuhACiC0yO4HQKUesz0mzPiEpUNm Rtcqm93HudO400TngOf0dnHsjbb6g4FjUQucxsY73Qt0934HJezzfNQKcme0f0JAtbj7 jPFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lPgZ9n5K; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gc4-20020a056214230400b005352f0d8ce1si2231124qvb.326.2023.02.03.06.58.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:20 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lPgZ9n5K; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxTg-0001lU-B7; Fri, 03 Feb 2023 09:55:48 -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 1pNxTe-0001gS-8B for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:55:46 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxTc-0005qu-Ct for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:55:45 -0500 Received: by mail-wr1-x429.google.com with SMTP id h16so4856423wrz.12 for ; Fri, 03 Feb 2023 06:55:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+umTNh0pbiZOqriKf5LBKbWjyWBQDWdA/pzjCDYec3I=; b=lPgZ9n5K6CrRTxxEvSmCqY3ghiogDX+rg/hCCPZOkska+sJM5KTqot5rIAqQeeMbEQ 9CYZPKlEaD1JEVEF+kffMJtFgVlO8oOgwhEfEfHmCk07Afv/GiyZrYS2/Zm3O1T7lm7B RB1tQMNLC8i1ObzebgXpBUa85iEhQvn5OKyH1oSAkAmo2R1nQfojrEj4k8KgL9HUbApg o0DMjNiDWI5mbBsEn6fLg6qwfmi8U8Gdgc9YaCwJnzO1v30khNF6OZZgmRXFcRoLp7Gh YPLJ2hHcAiiwQT6kw2GT+eag7pUW8LUb9B1kMXe2x+1eBVRweY4Jn51ExYzsFyvWpEKH 1OhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=+umTNh0pbiZOqriKf5LBKbWjyWBQDWdA/pzjCDYec3I=; b=XqPh7eDHbbQ3nF8oDcV2pzgF6xUU5knIarf5RVo6EDmY9CiwH7at+rpGAzB8GhPnqy qcENPfUL8opoVtGJoDB/6cBablw61vo2fkn+6MPJ5+kskS+7gEPGvUst1mnssoUqMenv qcCDIuakVLpd1nssZcws5G10Y4Ccm1gesTEpgDrBniQWt+l9c7FbADg5ErKQBNb5E7XG CNzCu2AIuCjsDk8vnQGBX9lB7/3Ak7dWdVYUWD8K0ZoW4E6bMNhfQRPkuMbxSqpK2u4D hclANCRbWhUod7fIIi4gIdWyEvX2jOyI+tnk9CzNS3WGDC1MOv5RZWI0HBBrVvMvJxXe jfbA== X-Gm-Message-State: AO0yUKUr5+57YTVx73B3rLAI9DlqVFkuvfVqEcYQW8+bUL1K2dD8mtkZ qBNghMMqw0JxwyRngWfY4DFMqj6Mx0E4e5kn X-Received: by 2002:adf:a102:0:b0:2bf:942b:ddc with SMTP id o2-20020adfa102000000b002bf942b0ddcmr8142730wro.55.1675436143513; Fri, 03 Feb 2023 06:55:43 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t10-20020a5d690a000000b002bbedd60a9asm2175645wru.77.2023.02.03.06.55.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:55:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH v2 01/15] hw/pci/pcie_sriov: Replace fprintf(error_pretty) -> warn_reportf_err() Date: Fri, 3 Feb 2023 15:55:22 +0100 Message-Id: <20230203145536.17585-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=philmd@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pcie_sriov.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index f0bd72e069..93b0624599 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -196,19 +196,17 @@ static void register_vfs(PCIDevice *dev) static void unregister_vfs(PCIDevice *dev) { - Error *local_err = NULL; uint16_t num_vfs = dev->exp.sriov_pf.num_vfs; uint16_t i; trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn), num_vfs); for (i = 0; i < num_vfs; i++) { + Error *errp = NULL; PCIDevice *vf = dev->exp.sriov_pf.vf[i]; - object_property_set_bool(OBJECT(vf), "realized", false, &local_err); - if (local_err) { - fprintf(stderr, "Failed to unplug: %s\n", - error_get_pretty(local_err)); - error_free(local_err); + object_property_set_bool(OBJECT(vf), "realized", false, &errp); + if (errp) { + warn_reportf_err(errp, "Failed to unplug: "); } object_unparent(OBJECT(vf)); } From patchwork Fri Feb 3 14:55:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650070 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp862851pva; Fri, 3 Feb 2023 06:56:47 -0800 (PST) X-Google-Smtp-Source: AK7set8MgqIYAG2OqFRvtQmca3jSeOH7yP4jPUmBw2tGKHx4xTlMxjzxp27FGWolFHvFf87+pSlb X-Received: by 2002:a05:622a:1015:b0:3a8:20fd:7111 with SMTP id d21-20020a05622a101500b003a820fd7111mr18877041qte.39.1675436206789; Fri, 03 Feb 2023 06:56:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436206; cv=none; d=google.com; s=arc-20160816; b=yDExIaybMSWqCaYQFs7Ld2GbrVS/GbvdfZ77EcVLon5sTnReqqUCK7sDVk5XuMb1aq oLqbx0OA5qwY6C0PFrdU0Zh0xFV+yFbFDHbdksy6tV7rswMb7PmT32h7CnYQYKFATjUo noBVMPRTcXpvJyu5/7irX1Ej1WM4HqZL5w+BOHu98A9+XclurZOGXSfCoalaprazrn4t 5k5ceitHSuAGInYt2uHZFmeLxxC5v0NfeI7oYCUUfxHurUd1ANqiayafuI6EFQwDqD1N k/y5iq2dg+j3YfDInXib+KV11pU8mTuXoZabPOClUK7uJFQDVT+KrJ6PeK1TmSVuoPMe 8VWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VmSnSD01/Tl/o5f4h6yNnxoegZSIU5/24i6LDQ+aBqo=; b=djfGfVZDXDhs+d2bAvAlSNwfisXkCF+AdhAXSGeiIlsSzkoO7wcuTnjsyrpUrrX5gr URwXo7OAg8/T0qq3aMnYgkjqjLt2SXAbhOKW35MDSNj/wZ6pvKAAbUlTZb0XcmsnBwJh 5bzKyhqLmzL9jlr3hAgVjK6/NAJrsAQrcH7I8flriBmqa6V5i+ub+12NKrhZlNgRd7lm EJWrBvz3dm4Hz79GWCb5vRfCYkFU3xMB4eL7cY40S35t8Ghy+y8zZoTIt96uEvboUymi 8kjsuZJWFrO0DV8wEFwZ6Rvp49jlep2DXom2c65IIj9VSSsAQhCJTdINVwcJiKTP1ZE5 ONnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UuQ+7F8J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v13-20020a05622a014d00b003b644e69427si2050535qtw.504.2023.02.03.06.56.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:56:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UuQ+7F8J; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxTl-0001pt-AJ; Fri, 03 Feb 2023 09:55:53 -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 1pNxTj-0001ow-QX for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:55:51 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxTi-0005sq-77 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:55:51 -0500 Received: by mail-wm1-x32e.google.com with SMTP id q8so4058175wmo.5 for ; Fri, 03 Feb 2023 06:55:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VmSnSD01/Tl/o5f4h6yNnxoegZSIU5/24i6LDQ+aBqo=; b=UuQ+7F8JTJaNCBvK0caVlsRKIND5qixPlQemm3ezQnSLNOpw7t/kIWpRuXEj8WMylX V7U9BE8cvioEF9ts4AMNpt4WKvrejRAtdYNTIVdbMxkSCyX4e6NKxmeoBbTiPjI8nmky R8dOsTs4eQo4EWFoadIq0IwOn7122cgHPvUqEZ5TGAm8vLUit9LyutoHwwm44D79uHfr lXmWeSgioW8kiZ4JnELMHXN5jIfbd9JtimYbkf524wr0zPE/+LIBW+ufNzJ+QVhV+8Yt Hj/oQGQ59trO3czVUbc1PCE/l6A7AkROapbtKOCm4NMHx4s/kYmiUEMGGu+Y0Bv4LizY SKfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=VmSnSD01/Tl/o5f4h6yNnxoegZSIU5/24i6LDQ+aBqo=; b=AGJ7kT5JTIxl+FOl2qPZwgvI2Z0ytwsUgh6H/+EpfqLFLqe6+AkSfdHuPCHWeCTvOf HBSf2av/umEn2SAOGVMiT4DsrbSJ07KhA2O2ug14FxZBZ/IghUFs/tUtD9+6Qjq94MSC OsPwlYdicY7dNiJuUxq8PZlwaZWgi9OikBWWtOmL4KWxlTTZrWjLN/ym/DXV3L3Ybw/h k/6hLrDI50HQ4pLLtUHRthpnkiDxadoDgNKqm/4SjshvZAdFtNCwwYpOUOi8s1f4NEMq ua/C5dM3GKenZiz4F0p61l9ClznAVGkpZ3dggmZ+Vgby4nXe79DY49+WSxdjs2zr0Shp tbIQ== X-Gm-Message-State: AO0yUKVzJDJIJZC3bX+7qYjmZVKENv6pHPy1axUljSSbc8yo0iXenCfC LuE1pAr9YqLTGSHyTYpZy9qsjNMo6U8z5MYk X-Received: by 2002:a05:600c:3d9a:b0:3df:e8c3:c612 with SMTP id bi26-20020a05600c3d9a00b003dfe8c3c612mr2213485wmb.7.1675436148715; Fri, 03 Feb 2023 06:55:48 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o14-20020a05600c4fce00b003dc1a525f22sm3048705wmq.25.2023.02.03.06.55.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:55:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v2 02/15] hw/qdev: Introduce qdev_unrealize_and_unref() Date: Fri, 3 Feb 2023 15:55:23 +0100 Message-Id: <20230203145536.17585-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Inspired-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- hw/core/qdev.c | 9 +++++++++ include/hw/qdev-core.h | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index d759c4602c..b9ef793d51 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -306,6 +306,15 @@ void qdev_unrealize(DeviceState *dev) object_property_set_bool(OBJECT(dev), "realized", false, &error_abort); } +bool qdev_unrealize_and_unref(DeviceState *dev, Error **errp) +{ + bool ret; + + ret = object_property_set_bool(OBJECT(dev), "realized", false, errp); + object_unref(OBJECT(dev)); + return ret; +} + static int qdev_assert_realized_properly_cb(Object *obj, void *opaque) { DeviceState *dev = DEVICE(object_dynamic_cast(obj, TYPE_DEVICE)); diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index fd11e9a82f..20b9220023 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -374,6 +374,8 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp); * for the only reference to the child device to be held by the parent * via the child<> property, and so the reference-count-drop done here * would be incorrect. For that use case you want qdev_realize(). + * + * Returns %true on success or %false if an error occured. */ bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp); @@ -397,6 +399,24 @@ bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp); * the life of the simulation and should not be unrealized and freed. */ void qdev_unrealize(DeviceState *dev); + +/** + * qdev_unrealize_and_unref: Unrealize a device and drop a reference + * @dev: device to unrealize + * @errp: pointer to error object + * + * Unrealize @dev and drop a reference. + * This is like qdev_unrealize(), except the caller must hold a + * (private) reference, which is dropped on return regardless of + * success or failure. + * + * Warning: most devices in QEMU do not expect to be unrealized. Only + * devices which are hot-unpluggable should be unrealized (as part of + * the unplugging process); all other devices are expected to last for + * the life of the simulation and should not be unrealized and freed. + */ +bool qdev_unrealize_and_unref(DeviceState *dev, Error **errp); + void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, int required_for_version); HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev); From patchwork Fri Feb 3 14:55:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650071 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863214pva; Fri, 3 Feb 2023 06:57:37 -0800 (PST) X-Google-Smtp-Source: AK7set/KNuUoMZovjcH+GNfb06wrNot8v9awEl93kcfI68TrJa1I52hfI7HgB1PT96SlE447l1aF X-Received: by 2002:ac8:59d2:0:b0:3b8:6ad1:7bf1 with SMTP id f18-20020ac859d2000000b003b86ad17bf1mr19248181qtf.39.1675436257151; Fri, 03 Feb 2023 06:57:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436257; cv=none; d=google.com; s=arc-20160816; b=mfWMG4+zilpl8SC1Jzvf5PIJS5BXE+UGvZjYNA6FU3gEWh/jguv23k+BvrbPAvWrGh yAjH2guxnjhjhLjtecrdlKoxchauI52gF75QujTcCVnI3hW679ceZ/j1E9HrhTGzmJO8 Zc/+PuOgsbsNPic+5U7mrlapyi56Sys6/yju/vyNgETApqokzv76bgXwKItK/NBGm+kt c7QVHTkaq3itFWK3Wj/c5/dBeeonAUJ8oGkXfQIeGt+MnsbKtdB0OAGhQqS9AgnQC/XU 7f+K/O+wYfcPZrz/NH79Ck26ZEJGR0oUUuFI91Omvt4dRdAFJ8L1tYd2plFQfv9QwL0Q Fjkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tZif2it4bxphJIlcF0dFkRLHSBXoWvT693QwJQjGzNo=; b=s+CVfhUbPx8+8X73wKj6DRCYAcILxvPUiv7tn0bj2ISLzfPMIuZLEFbxxcbxsQmMpU 2zGe7rOJnYZsgRGbmwDIWS8panMH0FGn5iYu9ONe7d4bEcys+GezMoa+ySZ5H1xgrwjm lkCEK/WuYaUzDU20Hvi0Cus4qZGQFHWANMxL6WamgBgqlKh1gPp/LYdCDfVcsT96h4WR EmT4I5id4jTZEHFLTwx80TmK6RmwH5hNT/aztQRcsdMCmPZZj9o/+bpf5mGV1R4qNqeQ RJFT5F0E0/iy04k3Lg0Za549kp+RxfMGHDXNz4DzOTfE84jQAcrZodpPvSerfipxC8ye q9oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e65UkPC5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u13-20020a05622a14cd00b003b86c80c129si2041804qtx.685.2023.02.03.06.57.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:57:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e65UkPC5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxTx-0001tF-6G; Fri, 03 Feb 2023 09:56:05 -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 1pNxTo-0001sT-UY for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:55:57 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxTn-0005tV-Bw for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:55:56 -0500 Received: by mail-wm1-x336.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so6206658wma.1 for ; Fri, 03 Feb 2023 06:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tZif2it4bxphJIlcF0dFkRLHSBXoWvT693QwJQjGzNo=; b=e65UkPC5QmpQDXpDZHki8/zuv9g086olkHcGAS66BX1U36sGP9oqOQf4gfvLXbmgWM ist1JU9OllFI7yZCBz6tNz6Ha/Ggei4zZSLQlDvRC+oetWcabyhOVeDcHTKcfE/DeOXT UlGqCAdz7du7/qgnw12RyoKAAetuy1z94c84H3hjNjLeW+PcZ5U7DVDaMLJ7lxhPexoJ 7jWJoIXNxbYR1XVgjE4nrS34K2iwKa+Fty3/Y9CwuYFmLH5RIrznYxJNDAPD8lsJEfUP P3jb9eGztYmj2MmzbdXCcLIFEU/loAdFWayXAa0CLBy7FJIdV3Cx8dFVHr8zwUYJFjJ3 r1fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=tZif2it4bxphJIlcF0dFkRLHSBXoWvT693QwJQjGzNo=; b=mnaKCuqcNvVOgfbiinkkqR1XH6YB49E3VmsvAlI4Gv4vCzEjTt+T+rrZ7xgv7ouU8B Yl4sDGDxRHMskJofr1hNbnBA7GrnR1TWDkUxG1DhTw9+DVNqzhd9ARmuEqfmzCNAhTqj T1IR0103VIqM9jK44lXzQ28zblSZ6h/X9T2IR1w9ugANznbrwL8kxewSK1PA8hHuzdND n7n4zax26ueq4wyy2/Z2QNvQBX/x6FZxFv+Pm0cVj9B9efMqDyZVzF+aOwstMJxt7Hzd WiSOWa1jWWygqaShc5Wbp8ggFgJLSEAFhmZ/lvkHrkYq3ypJdG0lV1NYSohkFTtcDS0D 9R8A== X-Gm-Message-State: AO0yUKXiPMkMcf4557MGpmt3ddxwbwu551D+dzbNqA0PI27r3WC/bMiD CP1UIPeJDz3kIJZl8yCpLxZKE+BTCeLyjpaR X-Received: by 2002:a05:600c:3491:b0:3db:fc4:d018 with SMTP id a17-20020a05600c349100b003db0fc4d018mr10875768wmq.40.1675436153732; Fri, 03 Feb 2023 06:55:53 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id y3-20020adfd083000000b002bfbda53b98sm2162717wrh.35.2023.02.03.06.55.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:55:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Laurent Vivier Subject: [PATCH v2 03/15] linux-user/syscall: Do not open-code qdev_unrealize_and_unref() Date: Fri, 3 Feb 2023 15:55:24 +0100 Message-Id: <20230203145536.17585-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org (See commits dc3edf8d8a "Convert to qdev_unrealize() manually" and 981c3dcd94 "Convert to qdev_unrealize() with Coccinelle"). Reported-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- linux-user/syscall.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1f8c10f8ef..9299f71126 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8642,8 +8642,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, if (CPU_NEXT(first_cpu)) { TaskState *ts = cpu->opaque; - object_property_set_bool(OBJECT(cpu), "realized", false, NULL); - object_unref(OBJECT(cpu)); + qdev_unrealize_and_unref(DEVICE(cpu), NULL); /* * At this point the CPU should be unrealized and removed * from cpu lists. We can clean-up the rest of the thread From patchwork Fri Feb 3 14:55:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650067 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp862697pva; Fri, 3 Feb 2023 06:56:29 -0800 (PST) X-Google-Smtp-Source: AK7set/rjT9L9nz7HJyHYC9OOpdhCAPCTXDnf/uLgKvu1uPDAiaX4mOoMzhljPaE3vefNxVXwYPf X-Received: by 2002:a05:622a:5c8:b0:3b8:6d57:93ab with SMTP id d8-20020a05622a05c800b003b86d5793abmr18790225qtb.0.1675436189382; Fri, 03 Feb 2023 06:56:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436189; cv=none; d=google.com; s=arc-20160816; b=wlqI7yAKgYJCeQ283HNpkXlv6Y52IgrSDHSZLwQuNJDQTa6EtLwVMEJPSx3nbWDj2T zBr+KMzO6VzyZMJJNhNjWf5fr9F/y2iSUqECQSuQyIpHnCP9LUHycZi+pnmavi6hgVWo Dx/S62uYU7g7tOloTp6zWX0QBOZD9E/u4aFXag3KeSfyisQ9RAFBHWcD6aZalqGVpaOU zurdfiobJJ7jdBQ9sRSmP+5otFKEAhcM7MVqPV9uSXTz5gnFPkFw2f/8w3oSkOOroH2q 9ebAUsKve4KbNmIop69ue5LTGfxtz+H33SVnDhaXtGTtuL9raaRf7YucBHJ2YUmH/8Xm WUkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b1jZnXzDBv6AIc7zb/xF5HP075z2PTTEUA4j1SOMKA0=; b=egDdDBdhtws+ssoxISWvhypsNq1xtjx7EcFz937GsK1hGCY+E+33FHMi0Y95hLSm4y xNBxQEcXIQWptgliBS3s9kTWX+QBWQ/UBPit45NgMgzFylwNGi4FVO1c2b+Ly+DzrMJM oePtFDXH9GxhlynVKeV+I75kd40hQcL3LuYkvQFu41sxOI1SbPY84CJrW5hkAVppR9rY YlHpQckLfwQ5NdH3hIl7pbiAcU0DkS4Nz0EgDRdR3beaxaSsnbONOOv0tznGL5PReLam x89p8bFAiQoHYKJAm7P/R6069E0wwEIFN2bW41pWC48K0rCuOJZwxCW1ZD6yDNQUeh/c 8XeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=migsbNgl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 4-20020ac85744000000b003a7f546c121si1908782qtx.256.2023.02.03.06.56.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:56:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=migsbNgl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxTy-0001zP-Qm; Fri, 03 Feb 2023 09:56:06 -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 1pNxTv-0001vF-Ue for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:04 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxTt-0005qt-OG for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:03 -0500 Received: by mail-wr1-x432.google.com with SMTP id q5so4929998wrv.0 for ; Fri, 03 Feb 2023 06:55:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b1jZnXzDBv6AIc7zb/xF5HP075z2PTTEUA4j1SOMKA0=; b=migsbNglUZNbUMbZsnqOnYplVzxov4rWnz/3LbovPpI3xN/b+/3PAfZCyXKzrPcsEg NTdiQmEITsLr5bClFauNa5rEOY+oQ+oh0KnKFOWliMz/iyNJSCIceYPYU6QWmn7jOCgn lfrvAEJT4rD20uEijSwWtS/0vsjwZCG1jSl8hbwu6oIn2LF4yq2dBqcjoYBAZX59z6DO nDyUV3COuPPq2Dw9S3hTYSX2PvUpgMVb6y4CvQKAtfTimWA6rwQNQuMsocGZZeZYZK+4 RVlXiwjSA0PlAIpsSCBABwChj+1ybm01+ozYJUOe2++kKF9WyddpVBUefIXZLLgneQnA hW4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=b1jZnXzDBv6AIc7zb/xF5HP075z2PTTEUA4j1SOMKA0=; b=AVNL/W9nkDt1F90hj2zN1KZz1eoqAo2Wy4JI1RGXzrjmKn1CqSuXsK93dj3YAE90E8 TKcxR6TWzLTzd/LF4F/Z6RPBNVjYbz56tnwzw5+m6dWC5aENXBp3cbM05Qz8VYckqmlw ukJljVB3CCB9ZR2VLFQphP9kVzX0qlAU4DhnPqIGoTjGljZ5EF7Fql71/GJ13JKmEeU+ QR6AqjusDuTE/sF132w3wxjTBtaWbq1U2T5yCsIvUAaTBV+weUD0AxcatlWQgYIVLE8M CPCago1VL6zpWcTPVp9F5ky08t+9kzVvRsIggpw8EhDOL6GlNQHA9eDYzva4mzVJPxpB lPZg== X-Gm-Message-State: AO0yUKVU8lCqxk8cqCYwxS0aMhGIZfXP8nclDsAZrE3gPitZyGj7sgYN kXyyXAriBt9ybHjV284oiaQyPjEjnyqRC5Wc X-Received: by 2002:a05:6000:1005:b0:2bf:b35d:2797 with SMTP id a5-20020a056000100500b002bfb35d2797mr8819725wrx.11.1675436158914; Fri, 03 Feb 2023 06:55:58 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id v1-20020adf8b41000000b002be505ab59asm2248695wra.97.2023.02.03.06.55.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:55:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH v2 04/15] hw/pci/pcie_sriov: Do not open-code qdev_unrealize_and_unref() Date: Fri, 3 Feb 2023 15:55:25 +0100 Message-Id: <20230203145536.17585-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org (See commits dc3edf8d8a "Convert to qdev_unrealize() manually" and 981c3dcd94 "Convert to qdev_unrealize() with Coccinelle"). Reported-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé --- hw/pci/pcie_sriov.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 93b0624599..0b6101302b 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -204,11 +204,10 @@ static void unregister_vfs(PCIDevice *dev) for (i = 0; i < num_vfs; i++) { Error *errp = NULL; PCIDevice *vf = dev->exp.sriov_pf.vf[i]; - object_property_set_bool(OBJECT(vf), "realized", false, &errp); - if (errp) { + + if (!qdev_unrealize_and_unref(DEVICE(vf), &errp)) { warn_reportf_err(errp, "Failed to unplug: "); } - object_unparent(OBJECT(vf)); } g_free(dev->exp.sriov_pf.vf); dev->exp.sriov_pf.vf = NULL; From patchwork Fri Feb 3 14:55:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650077 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863708pva; Fri, 3 Feb 2023 06:58:34 -0800 (PST) X-Google-Smtp-Source: AK7set/XSog0SI1YmGam8oX9WIMI7tqwD8eqt4D+CGsEf1zjkNS/JrqhABGaiXasDO1jp674Nqw2 X-Received: by 2002:a05:622a:196:b0:3b8:6d3a:5ed4 with SMTP id s22-20020a05622a019600b003b86d3a5ed4mr18368615qtw.67.1675436313949; Fri, 03 Feb 2023 06:58:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436313; cv=none; d=google.com; s=arc-20160816; b=N3Y/Rhoog3+C6OF0Ktsydbx2Ww71G6/WbMykc2eo+q5JRrXFcMKXNJzvewa4tKf0DK rZ1m5yyxmX31Hrk7FvilKpTkmruokjspV7O2MJvMn3c/7aBrTSDjlnUNX/nqSrLRk0ky duxMB9xqZzoFrWaGgPzYIgrwb10HpFHVnUjOz5AcInIXGrtLTcZdnEWlpuPkEdSHYDjb 950vsYpjZDlji/PBtin4GF7HlybfylE1dXoTct8A7o4vE8zCYtMqeAVVLc2R24Jxo56w WNpWfPUi0U6Ti0OcMe6u513HWwizKVZDb1gFsDm5ZOcxD3yWEy/c2OqnsG4SrPGiuddM gw9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WDUR7TYjLSIvLofe5Yaai1+QKInBgxE2ASTflQgOO30=; b=NYBrKDuISTC3wmfGRT1z+ot3tdwbw/nTE+jLKG9ooSyKirDai7NZy0nZcLQY3jsRoQ Ifthg3cZU29g4Z5pjgw3O5/ds7HordQnoNiXIDlTso2rLwHOfBP813onYq4CcmiQIepf 3LxIhn7JP9nJrlbr6WGVCXjcZWV1dYjfGkpXv+YpxJR+GkPQERBYwRT9HOJ4b0aGeCsN 2wxa71QywyII7+ALzmxdFah3N8fiMdaJXaQAcveniDD1BxNzpKc556JKf9v/afqrXyWd iPHDj91qV1tuYFa/NqIHJ4o6LzvzNkdvEj+Pmvbe6rnAgQIf/85XODs8D1TCERg9EPxc iFkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=co6U3Gbs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y20-20020ac85f54000000b003b9bd193f59si1900385qta.568.2023.02.03.06.58.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=co6U3Gbs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxU0-00021l-Qv; Fri, 03 Feb 2023 09:56:08 -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 1pNxTz-0001zW-7Y for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:07 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxTx-0005v2-Gd for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:06 -0500 Received: by mail-wm1-x336.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so2571313wms.0 for ; Fri, 03 Feb 2023 06:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WDUR7TYjLSIvLofe5Yaai1+QKInBgxE2ASTflQgOO30=; b=co6U3GbsDJJFY4pVZU4kiCaVdgc5JoqCG/yoosYneWzeGuAXKp52S85umVEABW6VC/ vG5zZI++4sVTwNag+e7zvu/jX/Z9H1HuEXOIHUk7P+LOmkUAxpXCp/MzN/PuY/xYL8AS UId+mN9Np3xWCJbdz01CchkAaBWuNy36A2+Ptadp8y/A7BY7ydDKdArSqODvsaxYDR17 DfOHxEdc6zLChVvg3POqKO0xxojy3T0FvQY7ECXspXMLFdkPATsO5vL+FFHk9vS4NvBF 2+d2Q6Lp4joe+MOeQBJQkgME4A8r9jX7IP6jeqJWH281VzLu8X1RFPnGbOFbTirxpfqf ADpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=WDUR7TYjLSIvLofe5Yaai1+QKInBgxE2ASTflQgOO30=; b=jQk4Xei8jTTah31LcILdAkYSDhm/U8IANq7l/kv6fUZZ+fTgcn93/ClYXc8vysrhhV sKF+olNQm2jHd6uRW/gSdfOpKtpfwI12THfhE270ID81vb7NxwQRsZ5vIUrf3TDYYdXR QiFSHo2Uquxs2PNg1g/epexppk8B6+huJjQPTL6kfDy1LI7UoNmYa6D2ES4Es7i+6tw/ LXB+5ElULo2KpVwEJEx//L2dUCVAoou90b+zuOquyEWOA/OMi32xmQZpZOQsdKBxKn7M JlN1+CEnxCQiW49dkDypNhZQNJrkmFaDGHywRfkwiyqLdLPN/V1mAKXw7gCjfY70bTGk ivwA== X-Gm-Message-State: AO0yUKV2UQZIwH4heE2Roaa/8qLPzyy8amFSxC3Rs9BKcUGDNp6PPwtF tzEFFBmwttoIYb4W9Glm7UNL7qQG3GgVtO20 X-Received: by 2002:a05:600c:54c5:b0:3dc:9ecc:22a with SMTP id iw5-20020a05600c54c500b003dc9ecc022amr10169316wmb.8.1675436163969; Fri, 03 Feb 2023 06:56:03 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id k24-20020a05600c0b5800b003cfa622a18asm8009272wmr.3.2023.02.03.06.56.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson Subject: [PATCH v2 05/15] hw/i386/sgx: Do not open-code qdev_realize_and_unref() Date: Fri, 3 Feb 2023 15:55:26 +0100 Message-Id: <20230203145536.17585-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/sgx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index db004d17a6..6a729bff94 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -285,7 +285,6 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) SGXEPCState *sgx_epc = &pcms->sgx_epc; X86MachineState *x86ms = X86_MACHINE(pcms); SgxEPCList *list = NULL; - Object *obj; memset(sgx_epc, 0, sizeof(SGXEPCState)); if (!x86ms->sgx_epc_list) { @@ -299,16 +298,15 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) &sgx_epc->mr); for (list = x86ms->sgx_epc_list; list; list = list->next) { - obj = object_new("sgx-epc"); + DeviceState *dev = qdev_new(TYPE_SGX_EPC); /* set the memdev link with memory backend */ - object_property_parse(obj, SGX_EPC_MEMDEV_PROP, list->value->memdev, - &error_fatal); + object_property_parse(OBJECT(dev), SGX_EPC_MEMDEV_PROP, + list->value->memdev, &error_fatal); /* set the numa node property for sgx epc object */ - object_property_set_uint(obj, SGX_EPC_NUMA_NODE_PROP, list->value->node, - &error_fatal); - object_property_set_bool(obj, "realized", true, &error_fatal); - object_unref(obj); + object_property_set_uint(OBJECT(dev), SGX_EPC_NUMA_NODE_PROP, + list->value->node, &error_fatal); + qdev_realize_and_unref(dev, NULL, &error_fatal); } if ((sgx_epc->base + sgx_epc->size) < sgx_epc->base) { From patchwork Fri Feb 3 14:55:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650080 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863821pva; Fri, 3 Feb 2023 06:58:47 -0800 (PST) X-Google-Smtp-Source: AK7set/fmrxhqAhwAk7IW16onTP+ZVECQuCLVD9Qfhk+kYExibUGAKnX9Cc0Rsshr+KylH4ehC4/ X-Received: by 2002:a0c:a918:0:b0:53b:8b22:6e77 with SMTP id y24-20020a0ca918000000b0053b8b226e77mr15315773qva.51.1675436327559; Fri, 03 Feb 2023 06:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436327; cv=none; d=google.com; s=arc-20160816; b=QNl+oCXOYV0JGC8io0WwXE1EBu6K2omKx1rAoor9JoWbtqCJt3xB2V7iG3284Iw3G/ deWdbc5eH0IJi7z0oUEEf7rRiff+cyr+3bGjMeI4lHx1OQrG9kUtoqlqWsztDdnWiMUg h9wz22llUcBQBcflxGgVyu4UV7IfmUPeJ2L0TDqTrLqOsbSpHFQxuAqkQ8YvsVYiCYUu 8PeIsEeAK77bIgezo4lxXdOFwNY4H2lXJ6p6iEg71baSaRjsno4CVBnjn4xj79Ffzfvj XkQYhqokPuKUsLmTNcvJ7Gxm2gEjdfnN52rAQuBMx4LBylRyjugxaonyV0CB3oMqhxfr 19hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B9zIETZDw8AzAYdvOUdcE4GWKCA1zFcGWd3/PyGieuU=; b=dT6jhxGKs6C4B40QPanawkZdDa38cJaME/spd9tZksGoVqFbShF7UTw6V9X0+CTzCo RXEwYY9l58pqW8pdwVDB+KbzIgpcVQLJ8XpY7q78Uw75v4lGbvoF3rEOTyqXzH9HIfJa om2vJHcY+Si3iqVOvulL6DepNXgeOWJ5jGniUYBwAINUqaWjsRPKMv63qZyQTeKIR6jo Foytt3HLcSVgPyIQv/MbSyY0wjsXNClwBepFH4wYMDy6q9x6qpVUQbwoRajvFqrVdFKF 8491SJVsg5mrqOHZX1IKmnISaTKyuypNsWTZMtqc1xqk2oX79rx0Tj1ZPUvrVPMv4z1O QACQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pTmP2R7B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d2-20020a0ce702000000b004c791803422si1785270qvn.5.2023.02.03.06.58.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pTmP2R7B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxU6-0002Ik-E3; Fri, 03 Feb 2023 09:56:14 -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 1pNxU4-0002Dc-IH for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:12 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxU2-0005wG-Ld for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:12 -0500 Received: by mail-wm1-x334.google.com with SMTP id k16so4070687wms.2 for ; Fri, 03 Feb 2023 06:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=B9zIETZDw8AzAYdvOUdcE4GWKCA1zFcGWd3/PyGieuU=; b=pTmP2R7B+z3eAJyd3o7EP53hEHnMbEhT84NZtKZwHlAz9ttqI/z/DmEyUTgurqhh2V zGBMtS0GEt0auuCAQL0m8tP0Lp4Qk8+4vJzHmNwWSWWpdYqXXHZkGmXZlDvvewCzyujF DWUHfZ0w7ZprzF7Ux9bA9IvTR4RgYvKCl/gtJWQauqPb1d9pyWMXUIrCTOWzl4lL41RY wUHyyXN8DnHGFHUFOdqBEGGS3h3lbridfsAwaG3NaHzxfH0UxoagYe0o1SWznXFo2cni D0XXC6sSNc+zQetYEMVAFet7mzYDeJvDLt6VEH3ml3zhfvW/dFslzqE3ODRAiprAVa8k 1XJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=B9zIETZDw8AzAYdvOUdcE4GWKCA1zFcGWd3/PyGieuU=; b=Ufd3oTOVEuwYEB+oV9e/L1AiV2WXPko6chMu4fdxalgfDKMPWWmHkaDXxYaShLwZAc eMgCuRCp0PpCzNNPgykFvmHcI4mK2JzHUGCNlPIHEZcZFM6wpeCtbQRdXpj+wcfqr8VI 9CcJdK+rszUc9iyXmJT93PkiL1nq87F2jec5UBXp0GLA+Nc2Sw+eIjlsyLlpjng+XA+1 srgdRxdaxEMwI/vc8jqJjOvWGZbYGBiYaIyiJ7PdmgNItaoQN9uJvx794zi8YpqD826Q sS94KSD4SHXSHTksFtgkabIQWjCB7MwTRnbGrBWOLemGCq+CSqrnlMmPIUv26LhdRfLb kykA== X-Gm-Message-State: AO0yUKVJ57sXemrf5PkMrXwnQwx8pIXLJGBNMgf8bju5etit3ZWDbkKD SqcXdWeaQWGyrvzouz/7a3fpydBRwdlXPjQ0 X-Received: by 2002:a05:600c:46ce:b0:3df:e1d1:e14c with SMTP id q14-20020a05600c46ce00b003dfe1d1e14cmr6897203wmo.20.1675436169010; Fri, 03 Feb 2023 06:56:09 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t6-20020a05600c450600b003dc433bb5e1sm3251692wmo.9.2023.02.03.06.56.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , BALATON Zoltan Subject: [PATCH v2 06/15] hw/ppc/sam460ex: Correctly set MAL properties Date: Fri, 3 Feb 2023 15:55:27 +0100 Message-Id: <20230203145536.17585-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org MAL properties are declared as uint8_t: static Property ppc4xx_mal_properties[] = { DEFINE_PROP_UINT8("txc-num", Ppc4xxMalState, txcnum, 0), DEFINE_PROP_UINT8("rxc-num", Ppc4xxMalState, rxcnum, 0), DEFINE_PROP_END_OF_LIST(), }; Correct the API use by setting the property using qdev_prop_set_uint8(). No behavioral change. Fixes: da116a8aab ("ppc/ppc405: QOM'ify MAL") Reviewed-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/sam460ex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 4a22ce3761..cf065aae0e 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -389,8 +389,8 @@ static void sam460ex_init(MachineState *machine) /* MAL */ dev = qdev_new(TYPE_PPC4xx_MAL); - qdev_prop_set_uint32(dev, "txc-num", 4); - qdev_prop_set_uint32(dev, "rxc-num", 16); + qdev_prop_set_uint8(dev, "txc-num", 4); + qdev_prop_set_uint8(dev, "rxc-num", 16); ppc4xx_dcr_realize(PPC4xx_DCR_DEVICE(dev), cpu, &error_fatal); object_unref(OBJECT(dev)); sbdev = SYS_BUS_DEVICE(dev); From patchwork Fri Feb 3 14:55:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650072 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863323pva; Fri, 3 Feb 2023 06:57:51 -0800 (PST) X-Google-Smtp-Source: AK7set8YfTol6YnTIICDzCdIZ6gDxRXnSzDZjiuB0sccE+PsFO8QpLEy9taW6g5zJtKJb7dCnlFF X-Received: by 2002:a0c:efce:0:b0:536:ba5e:6a8d with SMTP id a14-20020a0cefce000000b00536ba5e6a8dmr15042128qvt.22.1675436271658; Fri, 03 Feb 2023 06:57:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436271; cv=none; d=google.com; s=arc-20160816; b=RUos2FPe0q2pWiHLtS7iHg6aaghQ5aH7u0px1sgam42qb5/jWOqGOHTT6IXxJwurO5 X0XDYTOZmGKKQX1s6TLqJo+1CSZEPMMVuBMMlIEAqJI0vMOiyzs8XYUxW2x4cAGj24wx ao1IbqWKJHhGQwbw+co5TmWgevkN5xYdo6BvLFZQBxBrUPvu3u+Jn0RlOp92zlhsKvfX X6DPLO1Qotm2MOQbw7z7Jl/YrRfLcdvMXT9LTd1zPL6yEAIcbhqyMBgMSObv1YCGYuxK h5bu0gADLhQNy6KpTjvncKVuUfYYqS8mt1gAwlZIFFaIR2COtT4fyfRK5a8yqaorpu5v GSPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T7gfeI3mnZ+Wy6rurWRcclNKo/AI2l33cgu5mda3V+c=; b=kHCGIIfqWdPxWzm7RYmrC8aMGOuxOPxsR/V2SH0lvO8Uk6jJ7QS+nknkucZpBEtAEV O+Yi1IMmD4sM87yNMRkiLNhDQYzLxBhgNEmspM4rpb8+UQBUYlThkXztlJwxtfu1IcXF g85CUu/AdyiRYe5Giwg8RLUhPp3rrhBUnXs+N5V7AqUjNr6Dyy1ZBZsuYUK2trLwj0f8 EIPEkkBY3qhwxKpiJQmD26kOHM3AJBqL0Fqs82czG4P6k6nO6cMv/jybXkHBzX/Ay2/C 8I2BHUdCozmajIwizpWCdst64hJfXLyrqdkVAMEFNJ30QzVAOIkaMeMarGhfhO5EE0zP FUWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zfE1tKdx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 1-20020a0562140cc100b005377c27622csi2128777qvx.248.2023.02.03.06.57.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:57:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zfE1tKdx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUB-0002WO-Tk; Fri, 03 Feb 2023 09:56:19 -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 1pNxUA-0002Uz-EM for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:18 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxU7-0005xE-V4 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:18 -0500 Received: by mail-wm1-x330.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso6214958wms.0 for ; Fri, 03 Feb 2023 06:56:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T7gfeI3mnZ+Wy6rurWRcclNKo/AI2l33cgu5mda3V+c=; b=zfE1tKdxzx0uKfjd8INXMPrMnB30oF7VsFg/WfIThH1WKj6dF5HDFNGOi1gnr7j8bv hHklH0PQrZ6CYOWT4Z6k4p3HUixcEmoLOI945v9q1D+eIQSdHwPX9iWqTYeGQ2goS5Kz qc6H3N5zdlQJLlue2g/+8PMOkG55OYiyl0oLLS6EzWqMgC4stLNsS9v7heAASRzz4j+K uCPPwTeNLi8a1VscZhIvUk93GFdsTlkR5cJnQ9BwNbUdLXj+7O9vr6JBZctYtrFMe2By aN3jnnZnvST1aYx52mQUEwI85pCD6s0oNCGgfITT4RbTT1D8KLZWsSx6glEjX61r0hFR MLrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=T7gfeI3mnZ+Wy6rurWRcclNKo/AI2l33cgu5mda3V+c=; b=Ppnn/UCf6jGJliO8MyFvof3VDvOsjSx2HoBgYoHvSRbI67nmxVrx6Rwh/RJn1dmL2m SIhXF++Nq7U5Fj7jR+3UHF1ew6mz+OY5ZNq+HjglN0t/zExLfu/Uy/DlRbcpW6Pm0Eoz urM2/ZYNT/UNOyYylwOd3cuZMWO+Fx8AKJDMbIhHvXQeUlfWPjNgPHw4qlyJUNiVX6CS LMjkxg6vTMigAN9Kjc9IGyybq6tu1HkOzezchl06/sxW64uJYnYVzY/GGlisW3N3fIZs ByJ0QeepFZBjXi0TIobWo9Gk71xbgYstLDeKLXRrc4uZyXH9EgiaK6fcX4ruxTac/pTV 3ORw== X-Gm-Message-State: AO0yUKV5LgJOmHeTllmJPB2Zc2WL/ixMSYFs3fkbMSIiWugYNR5EhGFt 55svd4bTrUmJCximrFWaXSgGlQfb+hk4/Mnm X-Received: by 2002:a05:600c:314a:b0:3df:ee43:860b with SMTP id h10-20020a05600c314a00b003dfee43860bmr812324wmo.23.1675436174176; Fri, 03 Feb 2023 06:56:14 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id r16-20020a05600c459000b003da28dfdedcsm3332092wmo.5.2023.02.03.06.56.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Joel Stanley , Peter Maydell Subject: [PATCH v2 07/15] hw/arm/nrf51: Alias 'flash-size' QOM property in SoC object Date: Fri, 3 Feb 2023 15:55:28 +0100 Message-Id: <20230203145536.17585-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org No need to use an intermediate 'flash-size' property in the SoC object. Alias the property, so when the machine (here microbit) sets the value on the SoC, it is propagated to the flash object. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/microbit.c | 5 ++++- hw/arm/nrf51_soc.c | 10 +--------- hw/nvram/nrf51_nvm.c | 6 +++++- include/hw/arm/nrf51_soc.h | 1 - 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c index 50df362088..79b5574884 100644 --- a/hw/arm/microbit.c +++ b/hw/arm/microbit.c @@ -36,6 +36,7 @@ static void microbit_init(MachineState *machine) MicrobitMachineState *s = MICROBIT_MACHINE(machine); MemoryRegion *system_memory = get_system_memory(); MemoryRegion *mr; + int64_t flash_size; object_initialize_child(OBJECT(machine), "nrf51", &s->nrf51, TYPE_NRF51_SOC); @@ -43,6 +44,8 @@ static void microbit_init(MachineState *machine) object_property_set_link(OBJECT(&s->nrf51), "memory", OBJECT(system_memory), &error_fatal); sysbus_realize(SYS_BUS_DEVICE(&s->nrf51), &error_fatal); + flash_size = object_property_get_int(OBJECT(&s->nrf51), + "flash-size", &error_abort); /* * Overlap the TWI stub device into the SoC. This is a microbit-specific @@ -57,7 +60,7 @@ static void microbit_init(MachineState *machine) mr, -1); armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, - 0, s->nrf51.flash_size); + 0, flash_size); } static void microbit_machine_class_init(ObjectClass *oc, void *data) diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c index 34da0d62f0..cc4a636c51 100644 --- a/hw/arm/nrf51_soc.c +++ b/hw/arm/nrf51_soc.c @@ -24,9 +24,7 @@ * are supported in the future, add a sub-class of NRF51SoC for * the specific variants */ -#define NRF51822_FLASH_PAGES 256 #define NRF51822_SRAM_PAGES 16 -#define NRF51822_FLASH_SIZE (NRF51822_FLASH_PAGES * NRF51_PAGE_SIZE) #define NRF51822_SRAM_SIZE (NRF51822_SRAM_PAGES * NRF51_PAGE_SIZE) #define BASE_TO_IRQ(base) ((base >> 12) & 0x1F) @@ -122,11 +120,6 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) BASE_TO_IRQ(NRF51_RNG_BASE))); /* UICR, FICR, NVMC, FLASH */ - if (!object_property_set_uint(OBJECT(&s->nvm), "flash-size", - s->flash_size, errp)) { - return; - } - if (!sysbus_realize(SYS_BUS_DEVICE(&s->nvm), errp)) { return; } @@ -199,6 +192,7 @@ static void nrf51_soc_init(Object *obj) object_initialize_child(obj, "rng", &s->rng, TYPE_NRF51_RNG); object_initialize_child(obj, "nvm", &s->nvm, TYPE_NRF51_NVM); + object_property_add_alias(obj, "flash-size", OBJECT(&s->nvm), "flash-size"); object_initialize_child(obj, "gpio", &s->gpio, TYPE_NRF51_GPIO); @@ -215,8 +209,6 @@ static Property nrf51_soc_properties[] = { DEFINE_PROP_LINK("memory", NRF51State, board_memory, TYPE_MEMORY_REGION, MemoryRegion *), DEFINE_PROP_UINT32("sram-size", NRF51State, sram_size, NRF51822_SRAM_SIZE), - DEFINE_PROP_UINT32("flash-size", NRF51State, flash_size, - NRF51822_FLASH_SIZE), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/nvram/nrf51_nvm.c b/hw/nvram/nrf51_nvm.c index 7f1db8c423..bfae028fcd 100644 --- a/hw/nvram/nrf51_nvm.c +++ b/hw/nvram/nrf51_nvm.c @@ -26,6 +26,9 @@ #include "hw/qdev-properties.h" #include "migration/vmstate.h" +#define NRF51822_FLASH_PAGES 256 +#define NRF51822_FLASH_SIZE (NRF51822_FLASH_PAGES * NRF51_PAGE_SIZE) + /* * FICR Registers Assignments * CODEPAGESIZE 0x010 @@ -358,7 +361,8 @@ static void nrf51_nvm_reset(DeviceState *dev) } static Property nrf51_nvm_properties[] = { - DEFINE_PROP_UINT32("flash-size", NRF51NVMState, flash_size, 0x40000), + DEFINE_PROP_UINT32("flash-size", NRF51NVMState, + flash_size, NRF51822_FLASH_SIZE), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h index e52a56e75e..8cf0c21614 100644 --- a/include/hw/arm/nrf51_soc.h +++ b/include/hw/arm/nrf51_soc.h @@ -45,7 +45,6 @@ struct NRF51State { MemoryRegion twi; uint32_t sram_size; - uint32_t flash_size; MemoryRegion *board_memory; From patchwork Fri Feb 3 14:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650069 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp862795pva; Fri, 3 Feb 2023 06:56:40 -0800 (PST) X-Google-Smtp-Source: AK7set+6b9heKoxEsDdqjuNpukW6GHKRIiz2HgO1cQ92f1Rd5LsOvw+73mggeT6IXpx1Yn4rrUWQ X-Received: by 2002:a05:622a:1206:b0:3b8:2844:b7e1 with SMTP id y6-20020a05622a120600b003b82844b7e1mr19612259qtx.46.1675436200084; Fri, 03 Feb 2023 06:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436200; cv=none; d=google.com; s=arc-20160816; b=bCFN4+LtHSEAGsWqh724N0S0UE/Hldx5HaUe5Ivy9BLTCmIqyOeDVVDd2qbaFnWMNf yt0Q+Ct5Wt4faJdiNGjcvoBjs4b3bwNRdDz97uanb0rL1S1eI0esi+jbgnEyorcnS55E BqTpYeoA+yT3Gzma1dCUfDKfpDSsR4+KSHV5cg4SFvemVdWbLL2rkMhSuZkQgopJ79XC xFXAjPNoY8E0ILmkVBkEWazikv91umOQdAHxWdYcq/Ojrw5LII4q9noDt7Jt2C9uiGp6 OFPBSX80T3bwVO5g22ftfi0WC3DisKhiKh1RPeK92uyjs6asnDIgNahxLlDTkZdqNaiH 0WkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f2kBLJKaVnGetSSqtxpfAhCXISkwd1yaz8QImmDemGM=; b=e1dgJzT82tfHZOF7NaHE67DauegPa6TpZkpPopXbnc/niaPHPBdavY48f5pcgnW3xl Ykbyo06acleenfbjjonV1hGWTrsS3t4P4fQT/Bpy5TlQN9w6omfyPqcHFwUg0/hYI0iC ps4bxLro0IXMeYv5yAoYYoB3hEmp6Jkpbth3nmdY2EcG41T3Hbd0BJykj431RE5GAbHu TscrHXQBVb/twM2C6paB2dbO3a9ru1+dzbKWj3RFp4rSeAE6ywJdUHMj6Y3F/yXlKqS8 GUSsdAJJA6cOwosEFxcVvwdKrycAC3qdgvkR6wRvern5p11ACRqIw0TUUsGtFTO5wCWL QqBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KpY9LpkQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g17-20020ac842d1000000b003afebda923dsi1982390qtm.126.2023.02.03.06.56.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:56:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KpY9LpkQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUG-0002jD-Lu; Fri, 03 Feb 2023 09:56:25 -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 1pNxUF-0002ap-A0 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:23 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUC-0005v2-Bf for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:23 -0500 Received: by mail-wm1-x336.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so2571888wms.0 for ; Fri, 03 Feb 2023 06:56:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f2kBLJKaVnGetSSqtxpfAhCXISkwd1yaz8QImmDemGM=; b=KpY9LpkQkdmGdSECIUV03ptdpIF11O/6yKWpyzgdtyfnGMbcnM3z5Vxqexi6R4/TgB e+e+JhjV8ztHekJdrXiHPRztONz0hemLJEvBGr60OSxZjiIYXELaR+3NRO2AOfmM49tK pR6kFvrNO31fokNf4r9Iue3yONWo8OFso/G3agt4FuH7CDLaEZa0GwNiLxd0XP1SubTp 2oJU8HsL0L5OPvmKc/AM144hHOWjozKQurWbIc6O5c8BSftV9J7VIa5qvAXvrincUfQK QIOc/L86kAc0Q8cqxbk7dlgn4EoTRjsvKznly6tebyrditFVyuOtoTP0rNOd03Xlw4xU sGUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=f2kBLJKaVnGetSSqtxpfAhCXISkwd1yaz8QImmDemGM=; b=3y6DlRizZHIUKiA/A0yzS8bcdi2++5KnNyrnsJKW/YVOEJEepDF8TbRpsQ3UA224kU OdwsH8/Arg6GDoQM8x32S5aHpdU7McH+wAQFP7VEgqYSz++n9eBYm7gCARbvgYVP1sE5 +BF9qvYgCzN+8XAqnlOPWBKRS4yE0tkcwq3LwXBc0QcXQRzw4fRTbN+ciZJfE42hSSzF Sd3iahmVSFJloKsoY4lT2fKaGwZx0jAyeNcujxRjx35Vllde+WjsPaLNHVMM7ncENrbL KsCnvA/o4UtcgNTMfexKVWZGi+5X2c8XQspZmBfzPJ9odihABUyjNnf501mXKv6zOj0o J3kQ== X-Gm-Message-State: AO0yUKWPv8F9mgea/tf9NfJQ7gOM+tMriMKaXEy6uBMlgVnlyMNKUH1o lOiD+9z76YfjzCyNSBzsQ6MminFojjLbrsPS X-Received: by 2002:a05:600c:1d13:b0:3dc:5abb:2f50 with SMTP id l19-20020a05600c1d1300b003dc5abb2f50mr9505073wms.19.1675436179316; Fri, 03 Feb 2023 06:56:19 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t6-20020a05600c198600b003dc492e4430sm3022855wmq.28.2023.02.03.06.56.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Peter Maydell , Jean-Christophe Dubois , Andrey Smirnov Subject: [PATCH v2 08/15] hw/arm/fsl-imx: Alias 'phy-num' QOM property in SoC object Date: Fri, 3 Feb 2023 15:55:29 +0100 Message-Id: <20230203145536.17585-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org No need to use intermediate 'fec-phy-num' properties in the SoC object. Alias the properties, so when the machines set the value on the SoC, it is propagated to the network device object. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/fsl-imx25.c | 3 +-- hw/arm/fsl-imx6.c | 3 +-- hw/arm/fsl-imx6ul.c | 8 ++++---- hw/arm/fsl-imx7.c | 12 ++++++------ include/hw/arm/fsl-imx25.h | 1 - include/hw/arm/fsl-imx6.h | 1 - include/hw/arm/fsl-imx6ul.h | 2 -- include/hw/arm/fsl-imx7.h | 1 - 8 files changed, 12 insertions(+), 19 deletions(-) diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 24c4374590..eff58e1f7a 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -55,6 +55,7 @@ static void fsl_imx25_init(Object *obj) } object_initialize_child(obj, "fec", &s->fec, TYPE_IMX_FEC); + object_property_add_alias(obj, "fec-phy-num", OBJECT(&s->fec), "phy-num"); object_initialize_child(obj, "rngc", &s->rngc, TYPE_IMX_RNGC); @@ -169,7 +170,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) epit_table[i].irq)); } - object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num, &err); qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]); if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) { @@ -315,7 +315,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) } static Property fsl_imx25_properties[] = { - DEFINE_PROP_UINT32("fec-phy-num", FslIMX25State, phy_num, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 00dafe3f62..4f870c928c 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -100,6 +100,7 @@ static void fsl_imx6_init(Object *obj) object_initialize_child(obj, "eth", &s->eth, TYPE_IMX_ENET); + object_property_add_alias(obj, "fec-phy-num", OBJECT(&s->eth), "phy-num"); } static void fsl_imx6_realize(DeviceState *dev, Error **errp) @@ -377,7 +378,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) spi_table[i].irq)); } - object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, &err); qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]); if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) { return; @@ -451,7 +451,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) } static Property fsl_imx6_properties[] = { - DEFINE_PROP_UINT32("fec-phy-num", FslIMX6State, phy_num, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index d88d6cc1c5..8b3939e8c5 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -120,8 +120,12 @@ static void fsl_imx6ul_init(Object *obj) * Ethernet */ for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) { + g_autofree gchar *propname = g_strdup_printf("fec%d-phy-num", i + 1); snprintf(name, NAME_SIZE, "eth%d", i); object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET); + qdev_prop_set_uint32(DEVICE(&s->eth[i]), "phy-num", i); + object_property_add_alias(obj, propname, + OBJECT(&s->eth[i]), "phy-num"); } /* USB */ @@ -424,8 +428,6 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_ENET2_TIMER_IRQ, }; - object_property_set_uint(OBJECT(&s->eth[i]), "phy-num", - s->phy_num[i], &error_abort); object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", FSL_IMX6UL_ETH_NUM_TX_RINGS, &error_abort); qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); @@ -618,8 +620,6 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) } static Property fsl_imx6ul_properties[] = { - DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState, phy_num[0], 0), - DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState, phy_num[1], 1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index afc7480799..df035c9314 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -102,8 +102,12 @@ static void fsl_imx7_init(Object *obj) * Ethernet */ for (i = 0; i < FSL_IMX7_NUM_ETHS; i++) { - snprintf(name, NAME_SIZE, "eth%d", i); - object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET); + g_autofree gchar *propname = g_strdup_printf("fec%d-phy-num", i + 1); + snprintf(name, NAME_SIZE, "eth%d", i); + object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET); + qdev_prop_set_uint32(DEVICE(&s->eth[i]), "phy-num", i); + object_property_add_alias(obj, propname, + OBJECT(&s->eth[i]), "phy-num"); } /* @@ -402,8 +406,6 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) FSL_IMX7_ENET2_ADDR, }; - object_property_set_uint(OBJECT(&s->eth[i]), "phy-num", - s->phy_num[i], &error_abort); object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort); qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); @@ -599,8 +601,6 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) } static Property fsl_imx7_properties[] = { - DEFINE_PROP_UINT32("fec1-phy-num", FslIMX7State, phy_num[0], 0), - DEFINE_PROP_UINT32("fec2-phy-num", FslIMX7State, phy_num[1], 1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h index 1b1086e945..e377f8e79a 100644 --- a/include/hw/arm/fsl-imx25.h +++ b/include/hw/arm/fsl-imx25.h @@ -66,7 +66,6 @@ struct FslIMX25State { MemoryRegion rom[2]; MemoryRegion iram; MemoryRegion iram_alias; - uint32_t phy_num; }; /** diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h index 83291457cf..f7d1a94640 100644 --- a/include/hw/arm/fsl-imx6.h +++ b/include/hw/arm/fsl-imx6.h @@ -74,7 +74,6 @@ struct FslIMX6State { MemoryRegion caam; MemoryRegion ocram; MemoryRegion ocram_alias; - uint32_t phy_num; }; diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h index 7812e516a5..5217eeb8ff 100644 --- a/include/hw/arm/fsl-imx6ul.h +++ b/include/hw/arm/fsl-imx6ul.h @@ -88,8 +88,6 @@ struct FslIMX6ULState { MemoryRegion caam; MemoryRegion ocram; MemoryRegion ocram_alias; - - uint32_t phy_num[FSL_IMX6UL_NUM_ETHS]; }; enum FslIMX6ULMemoryMap { diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h index 4e5e071864..16c68a4937 100644 --- a/include/hw/arm/fsl-imx7.h +++ b/include/hw/arm/fsl-imx7.h @@ -82,7 +82,6 @@ struct FslIMX7State { IMX7GPRState gpr; ChipideaState usb[FSL_IMX7_NUM_USBS]; DesignwarePCIEHost pcie; - uint32_t phy_num[FSL_IMX7_NUM_ETHS]; }; enum FslIMX7MemoryMap { From patchwork Fri Feb 3 14:55:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650074 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863523pva; Fri, 3 Feb 2023 06:58:15 -0800 (PST) X-Google-Smtp-Source: AK7set8QSE1nYU5guJxAgNOFqp9o6Cu6/UblhwtnGfUpjnbT6SzwR8mHUwwESglTRHOi5PQVejwN X-Received: by 2002:a05:622a:1490:b0:3b6:3a8f:ecbc with SMTP id t16-20020a05622a149000b003b63a8fecbcmr8055093qtx.66.1675436295552; Fri, 03 Feb 2023 06:58:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436295; cv=none; d=google.com; s=arc-20160816; b=OWmPcY04YELULED8R1xQEVY2YY/5Wzgm8POgH3OFlXlJtPt03YxgqVrs+vWHGBFs/7 Zimayzatidt1Fm5JyMuJKUBT8yN7Fte98RCYz5beFZ5MTPFcjhbgdWckNxdgwIjaXAba somXZuPQQXz+Jgdzy6yBhlaD0c0lJHJPbDa7sB9ZSE+R6Bp7d1yUehGLBgh1B8ZhTK95 0z4EGesM/wFt04hM0Bf5vIwW0m0kBZMHUgJdaz9Oopqa+Yx9kvodcsIWskL4TWD4x4oY Bbq4lIYMh8Hmq4JYSCggoJnoc7iCW+cv44Tu33sBhAPFrjc5L0jUlkbcNHrAq54EoXi8 z2/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Tt1uD8O6Jt66Hf82NoAJiGFntdTbEbmQb2viJlepOPw=; b=LG0m0RWlcePCtF7vDM1lxayseTYTIoli/x/2g69zS9RcfCQWZL6bPoPqcgFssdbgXo 6qqGg/E7qfap6eZBuXyj0ZcwzKZtAdY+lFrBDQPC7ldbKLPWbSCf6BvB2Pz6qr1hX/TP WMjZTLpxy5rlGykZaB30bF3eSe6i7deDG0Hi3RLPuFBXsDTMoyFgbSN8BJIPEfsegZsr UW3J7U1YbEUBcS2pBtRGo56MaHd+mfJxa+kyh3mOU/CZvs4daKwJCEzW9Sy+pdJyIQri HrpqNWFSopYEcIu/zAA7hLDOR7aupQ8kGG8+2OmDLQ4Dz/wiyAxo+ZyiDXGHgwBzUgZk uhVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kgPcfaIR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 193-20020a3706ca000000b00706a9ff05e4si2031471qkg.513.2023.02.03.06.58.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:15 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kgPcfaIR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUK-0002zy-Jx; Fri, 03 Feb 2023 09:56:28 -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 1pNxUJ-0002tM-0X for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:27 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUH-0005v2-GZ for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:26 -0500 Received: by mail-wm1-x336.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so2572075wms.0 for ; Fri, 03 Feb 2023 06:56:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Tt1uD8O6Jt66Hf82NoAJiGFntdTbEbmQb2viJlepOPw=; b=kgPcfaIRM1Z0jwoP9KgR3Gps5Yb0WSkoc3jGN/Wq7MS0k2g3zoGLbP2bbL6kxEseNI eKYee2vG7kVadu96kswhvzz3FoY0JTDxHVjPNxSC2KFmc4jyAK8EtujmILOqnUFkyBbg yWBQOFkudUIr2lxT24987h34X4X7YzfO/Js1ujK1WqKePq0kbJFHlZYe3mZHrzRkxtxz Q4paVYSefBUQjYKfYe/5c0QIcx0BAM/WJHWX4LUZY9g5AeFG2g2iXBgrBvE3RMrkepyM njpgmTmgeX7rPXRI8F7Xbuh2c5/mdbCZ2sSKxjlFTvVtJucvIWUbCRbuWnd2F261lBXi IEjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Tt1uD8O6Jt66Hf82NoAJiGFntdTbEbmQb2viJlepOPw=; b=T+Zl3bEtUY+lIz0sFnoTwi3HsK/A2u+mPsmBk66L8TGg2JuhOf3P1Cmxl2VeOw0iJL 4YckgvZ3cfFhqMwVsxo9yu3Y9rSJBeVfoY5rY25wa4gftohg5rLBMCc55ZJOyyGgEC9W jeUlZRx9EPOTsWb3v2lYBpQu9tgVdH5xZVIuz+Hl21r742fGpVsDz7QwFsqEhbB5DEA7 /9V6iWrQPU2930HQtP/Im6kZac2gGFwhAZeHCbXaI1qgMj3gYXPi8mRzBufL9Bsa9HXh /sj3G5hBTbwPks+KXSsJZDvUw3I3+ClsMkQmCV4qtJ0MLDnfsgAimd/ECA/LJPMJ4Fns 97jQ== X-Gm-Message-State: AO0yUKU64WKqKFo6clsLxZAJr7kHwJ6Aj4Wn/JfXOf13a3aEV9+Zozdq 7JnNPYLlVe6XqX6378Ut60687hiUrxnDjBID X-Received: by 2002:a05:600c:16c4:b0:3dc:16d2:ae5e with SMTP id l4-20020a05600c16c400b003dc16d2ae5emr9981488wmn.32.1675436184316; Fri, 03 Feb 2023 06:56:24 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id l20-20020a05600c1d1400b003dfe8c4c497sm1995876wms.39.2023.02.03.06.56.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH v2 09/15] hw/usb/hcd-ohci: Include missing 'sysbus.h' header Date: Fri, 3 Feb 2023 15:55:30 +0100 Message-Id: <20230203145536.17585-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Avoid when including "hw/usb/hcd-ohci.h": hw/usb/hcd-ohci.h:100:5: error: unknown type name 'SysBusDevice' SysBusDevice parent_obj; ^ Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé --- hw/usb/hcd-ohci.h | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h index 11ac57058d..e5e6b434fd 100644 --- a/hw/usb/hcd-ohci.h +++ b/hw/usb/hcd-ohci.h @@ -21,6 +21,7 @@ #ifndef HCD_OHCI_H #define HCD_OHCI_H +#include "hw/sysbus.h" #include "sysemu/dma.h" #include "hw/usb.h" #include "qom/object.h" From patchwork Fri Feb 3 14:55:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650075 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863550pva; Fri, 3 Feb 2023 06:58:19 -0800 (PST) X-Google-Smtp-Source: AK7set/8Unby+rAcSUhcMpHplWBESosVDNiQPDNGTfvslt4Jw8Hdlr7IooJpYs8Kv9zwx7SfD5dV X-Received: by 2002:a05:622a:413:b0:3ba:807:99d9 with SMTP id n19-20020a05622a041300b003ba080799d9mr2858018qtx.6.1675436298873; Fri, 03 Feb 2023 06:58:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436298; cv=none; d=google.com; s=arc-20160816; b=KpoNRsLQgswolbnLf6TZ8zm/BIo9pLNY7sBToEdCJNVCOWloilXLZ8MZEmbGxR+2bv eeH1XxgIp+ftWG8Yi1LXXGdV5T5ODzTEYWTjOU0y/MwEcw5Wp1+1BsYHjAECsoJmhZNr QSRLC5lMqAQdijYZN6nx847RlS5bqMqQr3QO4syjn4PnQociWe6PQJ1SBkdpcMT5CRCh 2EOfMv+cImTSOckLanVPL+AD5I8KksmZhT8B4pASbkyUIOhoPrRHW8ZZ+Qfqge26o2cB CCrWcCrczNiXvEUOsZ08YPudwKPnqUt15w3dV3tgDuB7dRJ7RS6Zx0rwHU6d+VOuYxmD 8Y1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vGKludMgGFMX+UQNF2Pkwb7HGkjwWKhIN+mg23C0/DM=; b=LzwHRqIaVWm1F+IUIdTIGWESzKD12+WhIp1x2fnDxMLUJKxYH5I0wDabO8PDs2jcEY GEpbneRgJfM5cVASOuw+vLpW6GOS7bH12hsle1sjct4/Bbz6nStPnA1ITfO8n39Xq05w 6WefQx8rFIWDPkZmY0yoIsU6ldvcrizVxWT9pTzscitVVC6EvkfFkliP7NX0bCIuD08I V0rLTFb0HJvXcUxZjTgo4imuT2kJih5b/FHsKbhG28SYT7bj35rQJgTVwxBa8X1+4zmy J2fIb4oUhe/hFRTJJI8yWhR70kwfTRkQ9FFSvOsx5/b1DjDDPGZGFxX41DbovsKMPblI X94g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KPlkqMN9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e11-20020ac8414b000000b003b86b2773ffsi1846379qtm.122.2023.02.03.06.58.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KPlkqMN9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUR-0003H8-By; Fri, 03 Feb 2023 09:56: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 1pNxUP-0003EB-PU for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:33 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUN-00062R-1b for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:33 -0500 Received: by mail-wr1-x432.google.com with SMTP id o18so4896176wrj.3 for ; Fri, 03 Feb 2023 06:56:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vGKludMgGFMX+UQNF2Pkwb7HGkjwWKhIN+mg23C0/DM=; b=KPlkqMN9UHD8cpD/1lkqfCv6X7xEWggTCXYblmuXhu0/GZULwqVshuOWxS8tF3D2KI Lobpv+HAUSeiYJJwlZUJxKCHOr1+dBSffcrufnvd9rZU488lWvA11rWspas/rnXIJDIq fPII+bsuAgKyRK8pQXdxqg1mwA9UmWk0Tup080PpNiLluV1s0XY1wqZklyt3oBgRkGJG hGYPc4838Qlo7+cxll6M+OYtdMXXFVHRjA77EYdvr23Aimq+ZrYbjnh3DPBuR725iIn0 vnT13uh0hV0b6j6jIocQVw9YA75wcyWi+2COIKllTJCcMEFT5dPcAW5Crmuv47WEEn9O PJOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=vGKludMgGFMX+UQNF2Pkwb7HGkjwWKhIN+mg23C0/DM=; b=aXhho8ZnBUJX9CszcEWp3HNn2zUVeUeCuy6kqulIJ8naEVv0XRp37k1kbWol/j609a 3xOytB8TieqvFo9WiuF44I8JfFGGo7b/YNhSluCeQ2kc+qDVdT83zHOqzVE/KgKGxvqB 41ENNAqFFPFXEzI0N4OmVwZDkHTr/RAwmhhYyY4HJWb0Ma9yzNPoOnizMpsKssH+wQw+ fqVFVBkWSP4vU9LYKcqy5XNwlzF54SxQyF6o1DEEcHbemcilqetq62j1YapvbiGAwb5n M0XuqwKhEu5u9azrvzMpDhXM6mboewIiuO4g6kyzshIy8YM7s+UexIRdQnUB7igq7x2a fJzw== X-Gm-Message-State: AO0yUKUCU3Krmq0s5HRkDuUu5NDOLuTYqcVkhA+cDUcTUU0uTOjoY25u p7FFlaFilOdzJ7dxx9jA9HN7Tlxp4aOdI0Ja X-Received: by 2002:a5d:50c8:0:b0:2c3:db98:3e9c with SMTP id f8-20020a5d50c8000000b002c3db983e9cmr36525wrt.24.1675436189559; Fri, 03 Feb 2023 06:56:29 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id c13-20020a056000104d00b002bfebe2d67esm2250622wrx.9.2023.02.03.06.56.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:29 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , BALATON Zoltan Subject: [PATCH v2 10/15] hw/display/sm501: Embed OHCI QOM child in chipset Date: Fri, 3 Feb 2023 15:55:31 +0100 Message-Id: <20230203145536.17585-11-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Note this device doesn't implement unrealize(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: BALATON Zoltan --- hw/display/sm501.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 52e42585af..0f7e09d7e2 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -28,6 +28,7 @@ #include "qapi/error.h" #include "qemu/log.h" #include "qemu/module.h" +#include "hw/usb/hcd-ohci.h" #include "hw/char/serial.h" #include "ui/console.h" #include "hw/sysbus.h" @@ -1944,13 +1945,13 @@ struct SM501SysBusState { uint32_t vram_size; uint32_t base; SerialMM serial; + OHCISysBusState ohci; }; static void sm501_realize_sysbus(DeviceState *dev, Error **errp) { SM501SysBusState *s = SYSBUS_SM501(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); - DeviceState *usb_dev; MemoryRegion *mr; sm501_init(&s->state, dev, s->vram_size); @@ -1963,13 +1964,11 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->state.mmio_region); /* bridge to usb host emulation module */ - usb_dev = qdev_new("sysbus-ohci"); - qdev_prop_set_uint32(usb_dev, "num-ports", 2); - qdev_prop_set_uint64(usb_dev, "dma-offset", s->base); - sysbus_realize_and_unref(SYS_BUS_DEVICE(usb_dev), &error_fatal); + qdev_prop_set_uint64(DEVICE(&s->ohci), "dma-offset", s->base); + sysbus_realize_and_unref(SYS_BUS_DEVICE(&s->ohci), &error_fatal); memory_region_add_subregion(&s->state.mmio_region, SM501_USB_HOST, - sysbus_mmio_get_region(SYS_BUS_DEVICE(usb_dev), 0)); - sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev)); + sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ohci), 0)); + sysbus_pass_irq(sbd, SYS_BUS_DEVICE(&s->ohci)); /* bridge to serial emulation module */ sysbus_realize(SYS_BUS_DEVICE(&s->serial), &error_fatal); @@ -2016,8 +2015,12 @@ static void sm501_sysbus_class_init(ObjectClass *klass, void *data) static void sm501_sysbus_init(Object *o) { SM501SysBusState *sm501 = SYSBUS_SM501(o); + OHCISysBusState *ohci = &sm501->ohci; SerialMM *smm = &sm501->serial; + object_initialize_child(o, "ohci", ohci, TYPE_SYSBUS_OHCI); + qdev_prop_set_uint32(DEVICE(ohci), "num-ports", 2); + object_initialize_child(o, "serial", smm, TYPE_SERIAL_MM); qdev_set_legacy_instance_id(DEVICE(smm), SM501_UART0, 2); qdev_prop_set_uint8(DEVICE(smm), "regshift", 2); From patchwork Fri Feb 3 14:55:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650079 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863806pva; Fri, 3 Feb 2023 06:58:46 -0800 (PST) X-Google-Smtp-Source: AK7set883Z8T9sp4kyEMCbLkJ7AomY+6QC0jvU9tjYi6MCkcyWwc3YtcdQVuv8VCQ4LUf3me+bYQ X-Received: by 2002:ac8:7f8e:0:b0:3b9:2b0:5e7a with SMTP id z14-20020ac87f8e000000b003b902b05e7amr19222992qtj.25.1675436326429; Fri, 03 Feb 2023 06:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436326; cv=none; d=google.com; s=arc-20160816; b=Z5QLh7Z3UHQRgxRYE/DaRFnn63DraPzMLqtCzDpgww3vUvBBI+TyBbpHtlCwcjM0fA ei7BxrFOsb5zBH3dX6XN+hF/Awwbh55GiOueHAbHnul5Z0ni5Mf6qacxqRKt0R1wy9d0 RKrkuzbYL74GxdmluYYpjtnJwtD9XgQkMWFfF/W1isrp/WUKGVlo9KV+JNBd2xpAFsF6 WC9HpEA1RslEDJ/aFP6/rSq2cfTiAZoHScjdqeQKnG7EDICuM+wBG1xImNBFDZu9VEVD Xppm0jHB1Vlhnw0JIxkcUWzyP4BtpZvIffFyZ5HVV23c3MmlaZsL6OFShbsXM6hsVyS8 V7tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mN0VYqfwlRhVEGBvWVUoY9fpevsYWRdufb+QHnf9XBs=; b=WDpuWL+bGTkxWSS6OcJBUpDNwjv8NEZmOTyogKQxmOGRDh2PZe56iAdl3tjrnOB2PM kpxE64iZGv7gqMjnyFos7DczZ1qefHtwz7bRsOHjB6qu31y7xwAxMyzHmATiRvOyMtp3 0bAncMHVrzMXJY/fXN5ZxRl5YsCKO/+Hsmb4aT7p1K7Efp8fFH6gRvhVA9Gw89NlSpZ1 PQbmCL9U1lMegJrPrm5Ajl6Sg0+BigHD3TjQLxwYQZv5CAIunDav9ksOnAl+0EIcDXvl REt3DnaPvw66XHUihj7WCIK/xI251NSskeOOJDr2BocvPxhVfKhgKHoY2lp370Pn/v9w 7g3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IRudY8DD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t20-20020ac85894000000b003b9c185dc39si1978993qta.92.2023.02.03.06.58.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IRudY8DD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUW-0003Qb-T0; Fri, 03 Feb 2023 09:56: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 1pNxUU-0003MT-PA for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:38 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUS-00063x-QS for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:38 -0500 Received: by mail-wm1-x334.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso4038388wmq.5 for ; Fri, 03 Feb 2023 06:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mN0VYqfwlRhVEGBvWVUoY9fpevsYWRdufb+QHnf9XBs=; b=IRudY8DDtuihwIxYQR6jmlAatCsacvcZW5DjBbIZ2EoRJejf/pAUWseMauxY4wL4GJ 7ID6P2MmJaEw1evlkqJCXq9Whozs4gJlNydCKt5yXZXzXePLBRap3iTyFgtgeB9BIWgb yDKAibLC0sXnmyjl/FZ9PqY1XdWBUO5tqccB86DxySXC9SOGbc7JKWYPF0OFnLm070xv IQEcu/efvp8gdgKjqqPZW52ZZNOqGkrD/7lEe6zjAnyPPUHTrsbEX2UOPAExLXIiEaZN eBT3EWoGauKWvTT1Om1wqhTHA5P3Z6toagL1XlTtfBvoWL+HFw8Ax5yumwSdwm+l207S yA9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=mN0VYqfwlRhVEGBvWVUoY9fpevsYWRdufb+QHnf9XBs=; b=AEBL+ZDn+ZseGkOn5FAa7Rpl2e7B1I9GjiYTu2nnk/IKfJWPsQHDkcFt7HW9PKYzqT Gl4KeHBiu3qmI8PZsYLbO2bmNryD5+OBpNv50Pn2xwiOpOPuJGEToiLOKMEOEPOTaVqm k/4n9yM+QPY9iXAeoRePXxYjUhdtFTMMaJTIVn5GhpzoKuE/Vaskf5v5xcHgPMFQpJtD HQvbEZd+CFRR/q5F5whzvxfeOGqzFI3LhBwhUd792ZjUs2svzJgow27CYSnjJI2CZmwl jOn3Ll04jj6ahffJIjgDi9fNFq/zLz1GZpiKWbm7S4jEP1RdqsoS7DHK4WBmtLNtUXFp C+0Q== X-Gm-Message-State: AO0yUKXNDLlwFw5Xgv6+aClUNifBLFcSAZlAiHP4j+y9sSiYp4zCiqKC EIVPxtjQ0I1Dr1VGSL6Lb4GsWpjOrASJq8dk X-Received: by 2002:a05:600c:4711:b0:3df:e474:2ab2 with SMTP id v17-20020a05600c471100b003dfe4742ab2mr5135335wmo.33.1675436195202; Fri, 03 Feb 2023 06:56:35 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id p16-20020a05600c469000b003a84375d0d1sm8636224wmo.44.2023.02.03.06.56.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:34 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , BALATON Zoltan , Yoshinori Sato , Magnus Damm Subject: [PATCH v2 11/15] hw/display/sm501: Alias 'dma-offset' QOM property in chipset object Date: Fri, 3 Feb 2023 15:55:32 +0100 Message-Id: <20230203145536.17585-12-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org No need to use an intermediate 'dma-offset' property in the chipset object. Alias the property, so when the machine (here r2d-plus) sets the value on the chipset, it is propagated to the OHCI object. Note we can rename the chipset 'base' property as 'dma-offset' since the object is a non-user-creatable sysbus type. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: BALATON Zoltan --- hw/display/sm501.c | 7 ++----- hw/sh4/r2d.c | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 0f7e09d7e2..efebd93f1e 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1943,7 +1943,6 @@ struct SM501SysBusState { /*< public >*/ SM501State state; uint32_t vram_size; - uint32_t base; SerialMM serial; OHCISysBusState ohci; }; @@ -1964,7 +1963,6 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->state.mmio_region); /* bridge to usb host emulation module */ - qdev_prop_set_uint64(DEVICE(&s->ohci), "dma-offset", s->base); sysbus_realize_and_unref(SYS_BUS_DEVICE(&s->ohci), &error_fatal); memory_region_add_subregion(&s->state.mmio_region, SM501_USB_HOST, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->ohci), 0)); @@ -1979,7 +1977,6 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) static Property sm501_sysbus_properties[] = { DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), - DEFINE_PROP_UINT32("base", SM501SysBusState, base, 0), DEFINE_PROP_END_OF_LIST(), }; @@ -2019,6 +2016,7 @@ static void sm501_sysbus_init(Object *o) SerialMM *smm = &sm501->serial; object_initialize_child(o, "ohci", ohci, TYPE_SYSBUS_OHCI); + object_property_add_alias(o, "dma-offset", OBJECT(ohci), "dma-offset"); qdev_prop_set_uint32(DEVICE(ohci), "num-ports", 2); object_initialize_child(o, "serial", smm, TYPE_SERIAL_MM); @@ -2026,8 +2024,7 @@ static void sm501_sysbus_init(Object *o) qdev_prop_set_uint8(DEVICE(smm), "regshift", 2); qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN); - object_property_add_alias(o, "chardev", - OBJECT(smm), "chardev"); + object_property_add_alias(o, "chardev", OBJECT(smm), "chardev"); } static const TypeInfo sm501_sysbus_info = { diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 39fc4f19d9..d7020d6d2b 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -274,7 +274,7 @@ static void r2d_init(MachineState *machine) dev = qdev_new("sysbus-sm501"); busdev = SYS_BUS_DEVICE(dev); qdev_prop_set_uint32(dev, "vram-size", SM501_VRAM_SIZE); - qdev_prop_set_uint32(dev, "base", 0x10000000); + qdev_prop_set_uint64(dev, "dma-offset", 0x10000000); qdev_prop_set_chr(dev, "chardev", serial_hd(2)); sysbus_realize_and_unref(busdev, &error_fatal); sysbus_mmio_map(busdev, 0, 0x10000000); From patchwork Fri Feb 3 14:55:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650082 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp864443pva; Fri, 3 Feb 2023 07:00:04 -0800 (PST) X-Google-Smtp-Source: AK7set8xW+86lFqG5lxxmEuQ+ZidujzcdSoMh1wc33hCzC53WZ7lQO8vF/xN2mL8DX70U9tuRzao X-Received: by 2002:a05:6214:707:b0:537:b7da:fd9b with SMTP id c7-20020a056214070700b00537b7dafd9bmr14218058qvz.24.1675436404083; Fri, 03 Feb 2023 07:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436404; cv=none; d=google.com; s=arc-20160816; b=d6FOJ0SUu+iP3/Udbu2tQqswsWf1w8RK7e6k5iwxnpgNOIQXmf1QT5aO/vHvFE1k6e TIcwjdDB8UCgVU4IXlaiA1rQ02Br18b8Fe4du0L24XbBVyystSzfxAig1b17ghzwr6vu L9oYv4uDMqZHoy2U7nxa54CZzxzSv37UdkzVivDp5m0sgFX4K9SkBd/cWBxLWLFLhZEa aCXVuAtrO9UcML6gVePBM0x1RSr2keuB/fOjO6fIfN+5hlwzhbOoGY7rRdVVY1MC5B7R DyQvTFE8l39gH9BbBao2ZGxm/sWb4VSi2GEv9gVBlAttfROS9EgHK96aiwoQfnLJh2cX oI9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VgyTPh7msAYyuAXqahXOmNxtor/LOuPPEC+v7SLH2W8=; b=n55USnAJytRXvHoicR3hVNEGlr/vl8BkSu9WJ+ZBK1DbI7L1L8xqr8iDIL999viYWm RKu6IqW1WRBqdvVrBkQOd3jbPG5L7VOhQ3aZp+kdfh5x2I5dq+SPFQ3hEkrewULemCJ+ laS8QMCj1zZJW1u/3QAy348YhPmZ+ejs+rV62pJjhXvkQ6mveRGXq3D18iLhNg24rOOB 3w8jnygXzu5fPt7u+ThEP9hGif+EDrHDMna1hrWiWDUHHMG3RXBJGFQ9p0+lteUYvqsY N4mSkz8BhZqRk6Ol9r+HP/WsqwGpRWjmnRrcKhP1pAOQDvObTb4z5U4Il4Xi1LrfpcQ8 jnFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r84hhi6b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i8-20020a0cf948000000b005354ca36bafsi1723430qvo.157.2023.02.03.07.00.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 07:00:04 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r84hhi6b; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUa-0003WF-Eg; Fri, 03 Feb 2023 09:56: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 1pNxUZ-0003VX-Q7 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:43 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUX-00064g-Mf for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:43 -0500 Received: by mail-wm1-x32f.google.com with SMTP id n28-20020a05600c3b9c00b003ddca7a2bcbso4054232wms.3 for ; Fri, 03 Feb 2023 06:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VgyTPh7msAYyuAXqahXOmNxtor/LOuPPEC+v7SLH2W8=; b=r84hhi6bkgbF7U5gkkwUAmM9YrM7x6BKIexLXhgMtE2lqswqmHkfe9hxI8t5xBU14t dj5BB5ssopN1lAB1rE+24vzCtuLpXnutmtOJp2sNw/NJgL/vadMjKgkGXol4CWbdeOkf urZgd3AJ+lTm3bQMfL6+QI6l+6J2qiZKXt6Co+N3NcnIVdLqmdk4zztxpZj7+VPsKsXi EVo0REZlkgEc9d8GcRJ01DM3r13TABhWfLxLqlThF0cE80Rf+n0PHqJuPt5jvTimpStw G2FQE26wFzLDfBGQS3yc5mDs26GDI491hY0FH5mhZ6mIsNweKFbIbEamWXUZJaPd40cF +qZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=VgyTPh7msAYyuAXqahXOmNxtor/LOuPPEC+v7SLH2W8=; b=QQaFIFZt4YFcrpef1Jdh3EP268JJTQg5Fb2K2ZQXcOJDorRAwA+ljcYZAirxiXv57z wDG9oIK8tjc2lE4vzg6inc75g4YAvRrN8NS/0RJobIYNiSlkfCZIcpgfMHWZRcQZi6cA wVjNjBOSEGhFP3wVJ5mfmw2Qh90pd4UIkWEZ1qyhpovNNL4926AWD7B7BNpTEr3prP6b LU6TM5UYTUiY/sRqGtUHDjU23nwO7jLdfqxmGMipPdjEIPRARkJGLLaJvbYjEu5sEDRB S+saEt4R0vl7oMprbW0YrDA2F6sS7V9krJgiS/876hLx08xdmPpl8falbgy75Za1ctxJ s4mQ== X-Gm-Message-State: AO0yUKWpUZAZ6tb90S70ZpawsAs6hrtG2VyFWww4KaIXW14fxYLUVSTh 1eFnkc4dQwp23cTs5pQxsEV0kWqEQGGi83nN X-Received: by 2002:a05:600c:3588:b0:3df:e1e9:201d with SMTP id p8-20020a05600c358800b003dfe1e9201dmr5125160wmq.40.1675436200274; Fri, 03 Feb 2023 06:56:40 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id w14-20020a05600c474e00b003dfe57f6f61sm2543539wmo.33.2023.02.03.06.56.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:39 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , BALATON Zoltan Subject: [PATCH v2 12/15] hw/display/sm501: Unify common QOM properties Date: Fri, 3 Feb 2023 15:55:33 +0100 Message-Id: <20230203145536.17585-13-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since now PCI and SysBus properties are identical, unify them. Suggested-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: BALATON Zoltan --- hw/display/sm501.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index efebd93f1e..98375138b2 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1975,7 +1975,7 @@ static void sm501_realize_sysbus(DeviceState *dev, Error **errp) /* TODO : chain irq to IRL */ } -static Property sm501_sysbus_properties[] = { +static Property sm501_common_properties[] = { DEFINE_PROP_UINT32("vram-size", SM501SysBusState, vram_size, 0), DEFINE_PROP_END_OF_LIST(), }; @@ -2004,7 +2004,7 @@ static void sm501_sysbus_class_init(ObjectClass *klass, void *data) dc->realize = sm501_realize_sysbus; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->desc = "SM501 Multimedia Companion"; - device_class_set_props(dc, sm501_sysbus_properties); + device_class_set_props(dc, sm501_common_properties); dc->reset = sm501_reset_sysbus; dc->vmsd = &vmstate_sm501_sysbus; } @@ -2062,11 +2062,6 @@ static void sm501_realize_pci(PCIDevice *dev, Error **errp) &s->state.mmio_region); } -static Property sm501_pci_properties[] = { - DEFINE_PROP_UINT32("vram-size", SM501PCIState, vram_size, 64 * MiB), - DEFINE_PROP_END_OF_LIST(), -}; - static void sm501_reset_pci(DeviceState *dev) { SM501PCIState *s = PCI_SM501(dev); @@ -2098,7 +2093,7 @@ static void sm501_pci_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_DISPLAY_OTHER; set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories); dc->desc = "SM501 Display Controller"; - device_class_set_props(dc, sm501_pci_properties); + device_class_set_props(dc, sm501_common_properties); dc->reset = sm501_reset_pci; dc->hotpluggable = false; dc->vmsd = &vmstate_sm501_pci; From patchwork Fri Feb 3 14:55:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650078 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863760pva; Fri, 3 Feb 2023 06:58:41 -0800 (PST) X-Google-Smtp-Source: AK7set/6hl4meqEBYoU4nzFalVBMN68ju2dsKfk0iZjXcnjI8oiPXl7jEP1spj/IK3+TtSqdupv1 X-Received: by 2002:a05:6214:20e6:b0:56a:8ae2:413e with SMTP id 6-20020a05621420e600b0056a8ae2413emr1651448qvk.36.1675436320979; Fri, 03 Feb 2023 06:58:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436320; cv=none; d=google.com; s=arc-20160816; b=nuRW1kN4z9n5eNqopzkpbspXnHsyg1u1jVLCmTlwMQO0i97RY9IGcMjx49roSnlOOC WS0kUOV1zG2d7nCc89Crne9T34/f+H2stjzVm9teQuF4ZaW9Ip4kPi14i6FafIMPzio9 Cr4uOu+PXlK2UzsQ2J/ZuucVNjnCKii7Ybdxa41m9La9KULxk56l/LXNzpQGBs2mI5xp PaKR/CNExArIXEZU2v2OJqJLsq18SsEJMKvFnEH+ble+tJlu/hxkplgXHw3+n19YmCgn z7Y6l1PILDrQQWjNXetfgFVHeVpkcnO5nmGaCib0zSS7+k4zLMIZ9r8uBU2ydm97SJB/ t/tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=A0e0NEin6/qB1UWKlWtZ3V9I0KbRtGgK0QPchGtumd0=; b=lBf8Y/lNMcRyY03UjpUMoNlHOq1sglfFbEVQNcgN6kQOnADUl8+lc5zdArOdVG1FW8 rf5fY3qUuQr+MiE8BoFi2ccyr0pyA1JS+LNSXfm4RqpIhzWTrIPftrkO+zkd+W9Qnbua i8YsjO3D5JVRrF2PcvrAXe2M1fNTJLG3bn4ejti/toLZhPiLm/AqrGXAs9bTFwEanq9b 58URJAzFl9ZtZBL9BHhdk4gNcGdryKPeTDNNCY6qYXAazmNYAoDkFIuoculsW/w1WIZu zG0aXGhEens5sXiXPXaEdbdKlT6zhNRGUZdtelTLUHG/V8+lbfD2qcBcVffzM9XYIeC7 idUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UOwBBOx+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g13-20020a0cd7cd000000b004bbe31e3d72si1629656qvj.356.2023.02.03.06.58.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UOwBBOx+; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUf-0003jN-8a; Fri, 03 Feb 2023 09:56:49 -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 1pNxUe-0003iJ-7a for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:48 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUc-0005uy-96 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:47 -0500 Received: by mail-wm1-x335.google.com with SMTP id d4-20020a05600c3ac400b003db1de2aef0so4066579wms.2 for ; Fri, 03 Feb 2023 06:56:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A0e0NEin6/qB1UWKlWtZ3V9I0KbRtGgK0QPchGtumd0=; b=UOwBBOx+pSOAx6o+hT9sEcWjZyxdZrjr2CamsYDUfjBVb7aI3AnVNQUIyblDNfTr0Y c0vFDlEzUCDqg/JSurVSKPlGi4X8L0tRnVZesraz9IpixZp83xc2LP89dc0aACmI2cx1 hlZ5BcxLJ+PBKoq+U0SWPBkN+uYIuyrwDnunGbSjRB6rrg4EpnTGO3GVM+aMNFG4Vl/5 sSaP6LRx55j625wZbQe5LLmEu3JKXWPUweRd6Zq5jRXKhroGIiUyvlJdJ0E4OUQHOeqw ey+j91d3dr0XsRh5cFVBR5NQK2HrY5PwKvKS2lzkY91RiCdYCKUmrG8m++XjwgEnAaIz J70g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=A0e0NEin6/qB1UWKlWtZ3V9I0KbRtGgK0QPchGtumd0=; b=4iOwghUiyy+61THbr+3nVTZGxIKjiyvY0zCyOM0ven10JxcgfPOH/sGk2Cq0ly5t8+ HDCp9J/f7UkDcqZzfJxJCigntRj5eDSFaS25HdAejwLxUNRVzTtYkF5YBXtwhB/Im7+O 57OrHOCCc2nRl9l8N6njWuqZWCHAJSlQSXCB5uXrLH0aFPYbssA8v+Qvoim8ckwwko57 GTys3ygVZVuHakUXUePU3DdmNx80eB+yfQrRJr9fUtEYZ9JfDUAZZh4VwK6bszHD6gMs RZzcPOYFYc6BIx78Ejx+vnkoTCm06CrpTo0/coB909r4V2Iib/iPi99ezyDpqxGRL5+o 4NjQ== X-Gm-Message-State: AO0yUKWqYGlhjeXjDllkOnQx4ym4UjByAf12ISWXINoSw4mtufDXs7of aC7B6L2+diabt2iLy19tzLOfHYQsHjIueD9v X-Received: by 2002:a05:600c:c0d:b0:3dd:a4ad:ae45 with SMTP id fm13-20020a05600c0c0d00b003dda4adae45mr9636626wmb.12.1675436205411; Fri, 03 Feb 2023 06:56:45 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id c17-20020a7bc851000000b003dc530186e1sm7952124wml.45.2023.02.03.06.56.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann Subject: [PATCH v2 13/15] hw/qdev: Remove DEFINE_PROP_DMAADDR() and 'hw/qdev-dma.h' Date: Fri, 3 Feb 2023 15:55:34 +0100 Message-Id: <20230203145536.17585-14-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org DEFINE_PROP_DMAADDR() is only used once. Since it doesn't add much value, simply remove it, along with the header defining it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- hw/usb/hcd-ohci-pci.c | 1 - hw/usb/hcd-ohci.c | 3 +-- include/hw/qdev-dma.h | 16 ---------------- 3 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 include/hw/qdev-dma.h diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c index 6b630d35a7..92cc151264 100644 --- a/hw/usb/hcd-ohci-pci.c +++ b/hw/usb/hcd-ohci-pci.c @@ -25,7 +25,6 @@ #include "migration/vmstate.h" #include "hw/pci/pci_device.h" #include "hw/sysbus.h" -#include "hw/qdev-dma.h" #include "hw/qdev-properties.h" #include "trace.h" #include "hcd-ohci.h" diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 9d68036d23..26c377bf1b 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -33,7 +33,6 @@ #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" @@ -2008,7 +2007,7 @@ 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_UINT64("dma-offset", OHCISysBusState, dma_offset, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/qdev-dma.h b/include/hw/qdev-dma.h deleted file mode 100644 index b00391aa0c..0000000000 --- a/include/hw/qdev-dma.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Support for dma_addr_t typed properties - * - * Copyright (C) 2012 David Gibson, IBM Corporation. - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - */ - -#ifndef HW_QDEV_DMA_H -#define HW_QDEV_DMA_H - -#define DEFINE_PROP_DMAADDR(_n, _s, _f, _d) \ - DEFINE_PROP_UINT64(_n, _s, _f, _d) - -#endif From patchwork Fri Feb 3 14:55:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650081 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863974pva; Fri, 3 Feb 2023 06:59:10 -0800 (PST) X-Google-Smtp-Source: AK7set85fnlAWZN+FBfzGyuGknju8zhrHZeltwCvEzGj4Jju6vKsUS3MNHROn//J5jo06w7KFoSf X-Received: by 2002:a05:6214:51:b0:537:7d64:664d with SMTP id c17-20020a056214005100b005377d64664dmr7133409qvr.39.1675436349765; Fri, 03 Feb 2023 06:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436349; cv=none; d=google.com; s=arc-20160816; b=ZKUF3JtHqqtzV/7NPg4ViuiHi9P8B7dpgBeTlMwSndbv8WbzwVAcBtOcd+ZPmzz6NV CJZPrfFJBTSGtFHfK+Qca6/20LUOFmsDOVq3nYiT+xjWqUru0e2tx45bQMUWkQRnEz2o W8ZmSz5FEStJFu595IC6zxm9vPEIvmaq7g6eXGaCZUCsiAkGvgXf3R01oml4jCnWyzDs 9fntg5yzYHZwU+/6vMGRmEwFV6R9Rd/6TC6vGbsoxNScKcaOKcQFLZ8hSQMOUPhh3GK7 MADzyGLR7ADE1kyMVStZ6onljotSCfp1LNtYsyHPB6a1oqH2vgKEr3TED2zsWowh6Y5b +oDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EJd5TtZ9CjeRkTkoWKdyn/Q2ehPN6hId4MKx9NKONbE=; b=Q9EuNesDYZKBhvroZrzjI7ZOuiWxvvLmp1HzcYfgB05UXR4672iG5kARwVjCn/ijST K/ZD4Wub5aGsgUsulR2+OFFnMJFCcQ2kbunXsQ9g/d9OazVFAvTDuNW3SeaEnSummNe9 BQknSqTliPEJyq0v9wlB5oHTct3kXqxlz1nEzSyQK4qkOAUVBmzmu9iqSMdbxoWZu4Xs jngcDDL394ynbSuK0QEl6yl1BzOpyLEHClmim++gBqw73KJpuKHyEzhL21c2R/3e0JVb cdfClxpi4VT58T+bYA+KYuLd9l/HijNGnI8/lx9nV5a3Hh7J1dnTOdPtAD4Pnq5ccRpX PRqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iQBhaAZo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gv14-20020a056214262e00b005318cf5172asi2309673qvb.520.2023.02.03.06.59.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:59:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iQBhaAZo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUn-0004LS-5h; Fri, 03 Feb 2023 09:56:57 -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 1pNxUl-0004Dx-Ez for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:55 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUi-00066X-2g for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:55 -0500 Received: by mail-wm1-x334.google.com with SMTP id k16so4072089wms.2 for ; Fri, 03 Feb 2023 06:56:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EJd5TtZ9CjeRkTkoWKdyn/Q2ehPN6hId4MKx9NKONbE=; b=iQBhaAZoehQdMMYmFx3NhanpaFj5eVp2VwvNaim3lBwb8+vEq/n+tL/75AIkmYIo3T wvvSJt2N0KQtcCNSmvQDQyH/NJMF1S0gkx/iKpnaiYeHiqTHcp+kx70ySjYv/u67sqhC j8aRZKVSzIZF7R6bT+At7AdyFdUUwbOObtrnZ/GNk4PoBZuAZ85G98LzCT+4jKJ6GWJc 7hEOVUeJrJwyTDlTrzlIsoKtiOsZFSvIgMqASnsHTxS9nERlUi9NkfZ5vf1bfbu6WEMB MlbhIXKY49/BzjRnCqGQTq10TWcx4UomliBb6O6w/rAQlq1uEmhDm2wj/StL+EtoBBsk mxuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=EJd5TtZ9CjeRkTkoWKdyn/Q2ehPN6hId4MKx9NKONbE=; b=fUZx0dwq8QGKODhikkqoI2WXRmRZsNL1tRYnK/ixGVYUuc7wVCHo5FLDivYmePEd9R yRcNIPsnZpSm9VLPBHV6cYC1p65qWqKY5SIfevh4fBdygcHiTo1k+1//9JJj7cMQvb7y 1yqoAlNYhtKm/pzrXjn/D7UUnabsUgMPyACFOLaTD817noq1R4hxJhJ1s1oLPLxFKoJg T/6XTml51awx1JBlrc2VeB1oihZfA+/lWCdooFfFxIZxYLyaZwWrQGCfvSqsXZCnwSQo 7Hq+ZAdoj5UcUalmmj1YXwwQe1W8YDOB2XQjKZbDeItOHIvBWW/XTPQ7JhOXPvZ/Nucb 0xqg== X-Gm-Message-State: AO0yUKXwMW1m6hD2gKLljggXRaVQf68J7/92UIRmbnEKOiKuJqVDgI8T o6atxU0Pq0pFrQEWCazsPaQ6U1CM/aa7pecA X-Received: by 2002:a05:600c:3d98:b0:3df:50eb:7cd9 with SMTP id bi24-20020a05600c3d9800b003df50eb7cd9mr8290403wmb.14.1675436210520; Fri, 03 Feb 2023 06:56:50 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id m5-20020a7bcb85000000b003de8a1b06c0sm8138324wmi.7.2023.02.03.06.56.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Paul Burton , Aleksandar Rikalo , Aurelien Jarno , Jiaxun Yang Subject: [PATCH v2 14/15] hw/mips: Declare all length properties as unsigned Date: Fri, 3 Feb 2023 15:55:35 +0100 Message-Id: <20230203145536.17585-15-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Some length properties are signed, other unsigned: hw/mips/cps.c:183: DEFINE_PROP_UINT32("num-vp", MIPSCPSState, num_vp, 1), hw/mips/cps.c:184: DEFINE_PROP_UINT32("num-irq", MIPSCPSState, num_irq, 256), hw/misc/mips_cmgcr.c:215: DEFINE_PROP_INT32("num-vp", MIPSGCRState, num_vps, 1), hw/misc/mips_cpc.c:167: DEFINE_PROP_UINT32("num-vp", MIPSCPCState, num_vp, 0x1), hw/misc/mips_itu.c:552: DEFINE_PROP_INT32("num-fifo", MIPSITUState, num_fifo, hw/misc/mips_itu.c:554: DEFINE_PROP_INT32("num-semaphores", MIPSITUState, Since negative values are not used (the minimum is '0'), unify by declaring all properties as unsigned. Signed-off-by: Philippe Mathieu-Daudé --- hw/intc/mips_gic.c | 4 ++-- hw/mips/boston.c | 2 +- hw/mips/cps.c | 12 ++++++------ hw/mips/malta.c | 2 +- hw/misc/mips_cmgcr.c | 2 +- hw/misc/mips_itu.c | 4 ++-- include/hw/intc/mips_gic.h | 4 ++-- include/hw/misc/mips_cmgcr.h | 2 +- include/hw/misc/mips_itu.h | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/hw/intc/mips_gic.c b/hw/intc/mips_gic.c index bda4549925..4bdc3b1bd1 100644 --- a/hw/intc/mips_gic.c +++ b/hw/intc/mips_gic.c @@ -439,8 +439,8 @@ static void mips_gic_realize(DeviceState *dev, Error **errp) } static Property mips_gic_properties[] = { - DEFINE_PROP_INT32("num-vp", MIPSGICState, num_vps, 1), - DEFINE_PROP_INT32("num-irq", MIPSGICState, num_irq, 256), + DEFINE_PROP_UINT32("num-vp", MIPSGICState, num_vps, 1), + DEFINE_PROP_UINT32("num-irq", MIPSGICState, num_irq, 256), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/mips/boston.c b/hw/mips/boston.c index a9d87f3437..21ad844519 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -702,7 +702,7 @@ static void boston_mach_init(MachineState *machine) object_initialize_child(OBJECT(machine), "cps", &s->cps, TYPE_MIPS_CPS); object_property_set_str(OBJECT(&s->cps), "cpu-type", machine->cpu_type, &error_fatal); - object_property_set_int(OBJECT(&s->cps), "num-vp", machine->smp.cpus, + object_property_set_uint(OBJECT(&s->cps), "num-vp", machine->smp.cpus, &error_fatal); qdev_connect_clock_in(DEVICE(&s->cps), "clk-in", qdev_get_clock_out(dev, "cpu-refclk")); diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 2b436700ce..38acc57468 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -114,9 +114,9 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) /* Inter-Thread Communication Unit */ if (itu_present) { object_initialize_child(OBJECT(dev), "itu", &s->itu, TYPE_MIPS_ITU); - object_property_set_int(OBJECT(&s->itu), "num-fifo", 16, + object_property_set_uint(OBJECT(&s->itu), "num-fifo", 16, &error_abort); - object_property_set_int(OBJECT(&s->itu), "num-semaphores", 16, + object_property_set_uint(OBJECT(&s->itu), "num-semaphores", 16, &error_abort); object_property_set_bool(OBJECT(&s->itu), "saar-present", saar_present, &error_abort); @@ -133,7 +133,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) /* Cluster Power Controller */ object_initialize_child(OBJECT(dev), "cpc", &s->cpc, TYPE_MIPS_CPC); - object_property_set_int(OBJECT(&s->cpc), "num-vp", s->num_vp, + object_property_set_uint(OBJECT(&s->cpc), "num-vp", s->num_vp, &error_abort); object_property_set_int(OBJECT(&s->cpc), "vp-start-running", 1, &error_abort); @@ -146,9 +146,9 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) /* Global Interrupt Controller */ object_initialize_child(OBJECT(dev), "gic", &s->gic, TYPE_MIPS_GIC); - object_property_set_int(OBJECT(&s->gic), "num-vp", s->num_vp, + object_property_set_uint(OBJECT(&s->gic), "num-vp", s->num_vp, &error_abort); - object_property_set_int(OBJECT(&s->gic), "num-irq", 128, + object_property_set_uint(OBJECT(&s->gic), "num-irq", 128, &error_abort); if (!sysbus_realize(SYS_BUS_DEVICE(&s->gic), errp)) { return; @@ -161,7 +161,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) gcr_base = env->CP0_CMGCRBase << 4; object_initialize_child(OBJECT(dev), "gcr", &s->gcr, TYPE_MIPS_GCR); - object_property_set_int(OBJECT(&s->gcr), "num-vp", s->num_vp, + object_property_set_uint(OBJECT(&s->gcr), "num-vp", s->num_vp, &error_abort); object_property_set_int(OBJECT(&s->gcr), "gcr-rev", 0x800, &error_abort); diff --git a/hw/mips/malta.c b/hw/mips/malta.c index ec172b111a..af9021316d 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1066,7 +1066,7 @@ static void create_cps(MachineState *ms, MaltaState *s, object_initialize_child(OBJECT(s), "cps", &s->cps, TYPE_MIPS_CPS); object_property_set_str(OBJECT(&s->cps), "cpu-type", ms->cpu_type, &error_fatal); - object_property_set_int(OBJECT(&s->cps), "num-vp", ms->smp.cpus, + object_property_set_uint(OBJECT(&s->cps), "num-vp", ms->smp.cpus, &error_fatal); qdev_connect_clock_in(DEVICE(&s->cps), "clk-in", s->cpuclk); sysbus_realize(SYS_BUS_DEVICE(&s->cps), &error_fatal); diff --git a/hw/misc/mips_cmgcr.c b/hw/misc/mips_cmgcr.c index 3c8b37f700..66eb11662c 100644 --- a/hw/misc/mips_cmgcr.c +++ b/hw/misc/mips_cmgcr.c @@ -212,7 +212,7 @@ static const VMStateDescription vmstate_mips_gcr = { }; static Property mips_gcr_properties[] = { - DEFINE_PROP_INT32("num-vp", MIPSGCRState, num_vps, 1), + DEFINE_PROP_UINT32("num-vp", MIPSGCRState, num_vps, 1), DEFINE_PROP_INT32("gcr-rev", MIPSGCRState, gcr_rev, 0x800), DEFINE_PROP_UINT64("gcr-base", MIPSGCRState, gcr_base, GCR_BASE_ADDR), DEFINE_PROP_LINK("gic", MIPSGCRState, gic_mr, TYPE_MEMORY_REGION, diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index badef5c214..a06cdd10ea 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -549,9 +549,9 @@ static void mips_itu_reset(DeviceState *dev) } static Property mips_itu_properties[] = { - DEFINE_PROP_INT32("num-fifo", MIPSITUState, num_fifo, + DEFINE_PROP_UINT32("num-fifo", MIPSITUState, num_fifo, ITC_FIFO_NUM_MAX), - DEFINE_PROP_INT32("num-semaphores", MIPSITUState, num_semaphores, + DEFINE_PROP_UINT32("num-semaphores", MIPSITUState, num_semaphores, ITC_SEMAPH_NUM_MAX), DEFINE_PROP_BOOL("saar-present", MIPSITUState, saar_present, false), DEFINE_PROP_END_OF_LIST(), diff --git a/include/hw/intc/mips_gic.h b/include/hw/intc/mips_gic.h index eeb136e261..5e4c71edd4 100644 --- a/include/hw/intc/mips_gic.h +++ b/include/hw/intc/mips_gic.h @@ -211,8 +211,8 @@ struct MIPSGICState { /* GIC VP Timer */ MIPSGICTimerState *gic_timer; - int32_t num_vps; - int32_t num_irq; + uint32_t num_vps; + uint32_t num_irq; }; #endif /* MIPS_GIC_H */ diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h index 9fa58942d7..db4bf5f449 100644 --- a/include/hw/misc/mips_cmgcr.h +++ b/include/hw/misc/mips_cmgcr.h @@ -75,7 +75,7 @@ struct MIPSGCRState { SysBusDevice parent_obj; int32_t gcr_rev; - int32_t num_vps; + uint32_t num_vps; hwaddr gcr_base; MemoryRegion iomem; MemoryRegion *cpc_mr; diff --git a/include/hw/misc/mips_itu.h b/include/hw/misc/mips_itu.h index 50d961106d..ab6d286c38 100644 --- a/include/hw/misc/mips_itu.h +++ b/include/hw/misc/mips_itu.h @@ -57,8 +57,8 @@ struct MIPSITUState { SysBusDevice parent_obj; /*< public >*/ - int32_t num_fifo; - int32_t num_semaphores; + uint32_t num_fifo; + uint32_t num_semaphores; /* ITC Storage */ ITCStorageCell *cell; From patchwork Fri Feb 3 14:55:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650073 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp863464pva; Fri, 3 Feb 2023 06:58:09 -0800 (PST) X-Google-Smtp-Source: AK7set/Cz+lqsRlCEZ+opPHwwpkXXugWxfgf2NTcWidvSkhenyvNk+0IVJPN4/LmsflKF7lLyuqc X-Received: by 2002:a05:622a:120b:b0:3b0:3b56:58cb with SMTP id y11-20020a05622a120b00b003b03b5658cbmr19891301qtx.59.1675436289469; Fri, 03 Feb 2023 06:58:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436289; cv=none; d=google.com; s=arc-20160816; b=ZlkcH9VQqAd0igbd1TdEFGvSjpC970+Fce+rGztQxu8T4ySlIXoc4wtsGuhzKv1WZs 6+vFro2C66dUrxr3izi96V8wpu6N+F0dHra3+IFt+hKtpEKlCHrUuvpLMJgeEPSUUknQ mXfeXksZOQHv97kQyjdrKGRHjvvU+7GmePsrBBKWhEXqvMPnN52I1nX+X8zFHRZ1g12/ ZHf+tMXjPLA73y3YupzjWZzGPefmnzoRTAq5J614G7mJwnEGM9e2RU5rtZOizEMONS5H g/h5u+lyqzIKJmGzo/2zZprM1syaLFlUC6HEoTgQXFebTLBNrSVLdnTeIitKer9nxh4v n0Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dWk/17AxotpO2OiTLMBjakLfcxFYdT89H87fwCpt4bM=; b=cbQL+qpG/4uHtRcfpFH1pTHh9YL2PuTdqDMQTqtcTKN2vjlu1mwA2FGUxmf8EjlJ1S wMXyhERIdVACHFM4BHdObC97XDwhqx5iKR4VPX3UgahUFMnnG8NGm0ojT3lg43yFmAUo vKG0vVxFwWr5NJIakpXlJ4mQEKG3ZBP9XxO2paC9u3FFN/mplYBGHPmimN0H555c5ZRn gYoGVB6cBuAG25LzRBVf6s/FdkjCK0uJuyft13dDTb81ZjaKu+enw1FSfxK1tij6HCSF G0qNf0SzD1rTDw1+mTEHBj+Z75xHisMkK96OU4ELm0Nu/NGT/hv6MaRiWpwaiH4KbAvi O/1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V6lPwP4m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p3-20020a05622a00c300b003b844afef2dsi2123427qtw.687.2023.02.03.06.58.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:58:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V6lPwP4m; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUr-0004oS-4z; Fri, 03 Feb 2023 09:57:01 -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 1pNxUp-0004ft-Sq for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:59 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUm-00064g-Ig for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:59 -0500 Received: by mail-wm1-x32f.google.com with SMTP id n28-20020a05600c3b9c00b003ddca7a2bcbso4054732wms.3 for ; Fri, 03 Feb 2023 06:56:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dWk/17AxotpO2OiTLMBjakLfcxFYdT89H87fwCpt4bM=; b=V6lPwP4mC1QInCRGj5307s5pjCiA3lKNJkUvWVx8fuaigPxk6PbhynIY4EZDMGToJ5 Mbh5RPJZOYY1D3M1Xmq72e2vUUh2MJvYkUrl4vE7Tk7DiZEJHZ0M/aadotqv6B/KKNjT RK8vkFsmTXOaMED8fAdbQxODS1T3EiGxu2bGq0SCeKAnk5Mf0dCQjbn6Y4YjBU4XU3Pn +6Voic1JIfNOM0QPPQN8qhznpyCj7VxrSCvxiTD8e/tTXeKrPq48mc0sN8a3/vmaCtO0 zAz1tD7vIuaMIonMzXasOoTBFPphFNCXj610evAkNbgA/V744waaweh5LIltdFJ+3KQI UpFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=dWk/17AxotpO2OiTLMBjakLfcxFYdT89H87fwCpt4bM=; b=DRGOG+wiCdVZlgFrf1wpmxm7OpPScZ5FvGTtXn74znyX2Kx1Tti7LbLtMpMbYLk4yA XTRNB02xUoMWRYd2elKDxTZBzIHPxO9v37cKvFLQH5/4rny+9S2CL2gRk3F6+hIg0kW2 yQrfRh5B4K84oRZjpqbNkT3qFcY+U/9DF+IPN2NI6ZepiwyAYQ6iCpfgJmq/7aSYpkW8 T0ED+viYtSYtqwUrp4aOfYh41abTr6beCi+qOEIi4NT2Twzwgz1/cYrkvC8Ug+lNihpL icTKmY1wwDdm41r/rf7SmEgRdERPvnPCz9tvHoYN1H5uFLfTFnKVR4eppxneFfepas1y GYlg== X-Gm-Message-State: AO0yUKXbciUbPkgt8+MDTVoCozLDIV2yGkmYhYS1fuyQowWe6SqhCQqt MTcZyfk2/knc5V96OgYJPzyQo/97zJErlQoN X-Received: by 2002:a05:600c:3ba5:b0:3d3:4007:9c88 with SMTP id n37-20020a05600c3ba500b003d340079c88mr12435443wms.18.1675436215514; Fri, 03 Feb 2023 06:56:55 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id l21-20020a05600c1d1500b003dc59d6f2f8sm3268871wms.17.2023.02.03.06.56.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Jiaxun Yang Subject: [RFC PATCH v2 15/15] hw/mips/itu: Pass SAAR using QOM link property Date: Fri, 3 Feb 2023 15:55:36 +0100 Message-Id: <20230203145536.17585-16-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org QOM objects shouldn't access each other internals fields except using the QOM API. mips_cps_realize() instantiates a TYPE_MIPS_ITU object, and directly sets the 'saar' pointer: if (saar_present) { s->itu.saar = &env->CP0_SAAR; } In order to avoid that, pass the MIPS_CPU object via a QOM link property, and set the 'saar' pointer in mips_itu_realize(). Signed-off-by: Philippe Mathieu-Daudé --- RFC because not tested. --- hw/mips/cps.c | 23 ++++++----------------- hw/misc/mips_itu.c | 26 ++++++++++++++++++-------- include/hw/misc/mips_itu.h | 5 ++--- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 38acc57468..2b5269ebf1 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -66,20 +66,17 @@ static bool cpu_mips_itu_supported(CPUMIPSState *env) static void mips_cps_realize(DeviceState *dev, Error **errp) { MIPSCPSState *s = MIPS_CPS(dev); - CPUMIPSState *env; - MIPSCPU *cpu; - int i; target_ulong gcr_base; bool itu_present = false; - bool saar_present = false; if (!clock_get(s->clock)) { error_setg(errp, "CPS input clock is not connected to an output clock"); return; } - for (i = 0; i < s->num_vp; i++) { - cpu = MIPS_CPU(object_new(s->cpu_type)); + for (int i = 0; i < s->num_vp; i++) { + MIPSCPU *cpu = MIPS_CPU(object_new(s->cpu_type)); + CPUMIPSState *env = &cpu->env; /* All VPs are halted on reset. Leave powering up to CPC. */ if (!object_property_set_bool(OBJECT(cpu), "start-powered-off", true, @@ -97,7 +94,6 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) cpu_mips_irq_init_cpu(cpu); cpu_mips_clock_init(cpu); - env = &cpu->env; if (cpu_mips_itu_supported(env)) { itu_present = true; /* Attach ITC Tag to the VP */ @@ -107,22 +103,15 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) qemu_register_reset(main_cpu_reset, cpu); } - cpu = MIPS_CPU(first_cpu); - env = &cpu->env; - saar_present = (bool)env->saarp; - /* Inter-Thread Communication Unit */ if (itu_present) { object_initialize_child(OBJECT(dev), "itu", &s->itu, TYPE_MIPS_ITU); + object_property_set_link(OBJECT(&s->itu), "cpu[0]", + OBJECT(first_cpu), &error_abort); object_property_set_uint(OBJECT(&s->itu), "num-fifo", 16, &error_abort); object_property_set_uint(OBJECT(&s->itu), "num-semaphores", 16, &error_abort); - object_property_set_bool(OBJECT(&s->itu), "saar-present", saar_present, - &error_abort); - if (saar_present) { - s->itu.saar = &env->CP0_SAAR; - } if (!sysbus_realize(SYS_BUS_DEVICE(&s->itu), errp)) { return; } @@ -158,7 +147,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gic), 0)); /* Global Configuration Registers */ - gcr_base = env->CP0_CMGCRBase << 4; + gcr_base = MIPS_CPU(first_cpu)->env.CP0_CMGCRBase << 4; object_initialize_child(OBJECT(dev), "gcr", &s->gcr, TYPE_MIPS_GCR); object_property_set_uint(OBJECT(&s->gcr), "num-vp", s->num_vp, diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index a06cdd10ea..0eda302db4 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -93,10 +93,10 @@ void itc_reconfigure(MIPSITUState *tag) uint64_t size = (1 * KiB) + (am[1] & ITC_AM1_ADDR_MASK_MASK); bool is_enabled = (am[0] & ITC_AM0_EN_MASK) != 0; - if (tag->saar_present) { - address = ((*(uint64_t *) tag->saar) & 0xFFFFFFFFE000ULL) << 4; - size = 1ULL << ((*(uint64_t *) tag->saar >> 1) & 0x1f); - is_enabled = *(uint64_t *) tag->saar & 1; + if (tag->saar) { + address = (tag->saar[0] & 0xFFFFFFFFE000ULL) << 4; + size = 1ULL << ((tag->saar[0] >> 1) & 0x1f); + is_enabled = tag->saar[0] & 1; } memory_region_transaction_begin(); @@ -157,7 +157,7 @@ static inline ITCView get_itc_view(hwaddr addr) static inline int get_cell_stride_shift(const MIPSITUState *s) { /* Minimum interval (for EntryGain = 0) is 128 B */ - if (s->saar_present) { + if (s->saar) { return 7 + ((s->icr0 >> ITC_ICR0_BLK_GRAIN) & ITC_ICR0_BLK_GRAIN_MASK); } else { @@ -515,6 +515,7 @@ static void mips_itu_init(Object *obj) static void mips_itu_realize(DeviceState *dev, Error **errp) { MIPSITUState *s = MIPS_ITU(dev); + CPUMIPSState *env; if (s->num_fifo > ITC_FIFO_NUM_MAX) { error_setg(errp, "Exceed maximum number of FIFO cells: %d", @@ -526,6 +527,15 @@ static void mips_itu_realize(DeviceState *dev, Error **errp) s->num_semaphores); return; } + if (!s->cpu0) { + error_setg(errp, "Missing 'cpu[0]' property"); + return; + } + + env = &s->cpu0->env; + if (env->saarp) { + s->saar = env->CP0_SAAR; + } s->cell = g_new(ITCStorageCell, get_num_cells(s)); } @@ -534,8 +544,8 @@ static void mips_itu_reset(DeviceState *dev) { MIPSITUState *s = MIPS_ITU(dev); - if (s->saar_present) { - *(uint64_t *) s->saar = 0x11 << 1; + if (s->saar) { + s->saar[0] = 0x11 << 1; s->icr0 = get_num_cells(s) << ITC_ICR0_CELL_NUM; } else { s->ITCAddressMap[0] = 0; @@ -553,7 +563,7 @@ static Property mips_itu_properties[] = { ITC_FIFO_NUM_MAX), DEFINE_PROP_UINT32("num-semaphores", MIPSITUState, num_semaphores, ITC_SEMAPH_NUM_MAX), - DEFINE_PROP_BOOL("saar-present", MIPSITUState, saar_present, false), + DEFINE_PROP_LINK("cpu[0]", MIPSITUState, cpu0, TYPE_MIPS_CPU, MIPSCPU *), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/misc/mips_itu.h b/include/hw/misc/mips_itu.h index ab6d286c38..35218b2d14 100644 --- a/include/hw/misc/mips_itu.h +++ b/include/hw/misc/mips_itu.h @@ -72,9 +72,8 @@ struct MIPSITUState { uint64_t icr0; /* SAAR */ - bool saar_present; - void *saar; - + uint64_t *saar; + MIPSCPU *cpu0; }; /* Get ITC Configuration Tag memory region. */