From patchwork Fri Jan 5 15:41:54 2024 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: 760157 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp103350wru; Fri, 5 Jan 2024 07:44:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxcsMpa1bjKZNb3w4uKX+oqN8uN6gmM5mIWVT8wdp7BRXtjF37SuUBJwJ+DZ+x94A1A6TS X-Received: by 2002:ad4:5945:0:b0:680:b48c:b54b with SMTP id eo5-20020ad45945000000b00680b48cb54bmr2134971qvb.102.1704469449052; Fri, 05 Jan 2024 07:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469449; cv=none; d=google.com; s=arc-20160816; b=odBfX29gemhFlfXL5gk/+/xRDUpG6Ozd+w9M7c/aEQLOZZ23JfNGShojdkPP1sm48d EmRQEUgcsV/FGg4dcI5XzpPwiro+TXv4IlSLJ4W2Mx1MhcG8SfuOUg+rhfLplWBPzkQY LJgDbirplfmi3peGEvw5J2q0AGBvBX9bQQsiHS+Kci2AS17rBIleWU31I2wTtbudCG1x 00L7PzknSTYaZbQEqSwk6CBf1pQcHyaG0nsm3kJ0khbsen2g1BLMFL/4plONoRP7gVnN 0jsr5eMyG9lAc4BYPLp0yoQkk1FIUBcfuX12IjHb8+3VWPGJtUPbxvSzVS0rL6o0zkOA QYZA== 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=dyYYg5j1yzG/KRM3hwRmq5l0B0UfdF1Z3FJP8e3OduU=; fh=cGniVOo2w4T75EmbdbuAUpszShLm7aJ3CpZXXDVo9P4=; b=YxHJvIvT+pXyouVXmXzpfrCg1WV0TBCPKObCblSynLYcWnIP9Z+p1hoAQSJKWA1OGz 3jo9F4cKdFpT/Hm7SDx3UMTTAic8c+s1nkEVApz6L9yqnXpNkQgkgIJRyvqO9nL9RqyQ IuwCMi5odaD4v8kKkX9qgYdWVdFlfoHZRnnTWeVsSdXAz+5HYt8lrWpWW2WGpUvIgKQA gWyOy02yYPlr6onH7qoNZfbLI6J68vxt2SfNEbRBxDQF+8cUebpoU7IrLeXEP2nmEUkB eIMredm0z66Kix5VHccbjhcXYn14AZM1yKyfZFMET/ge3ZqLxsiW8PQPYnShXOlXkUeP wWYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cOTdFLzk; 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 dw27-20020a05620a601b00b0078160875057si2059872qkb.74.2024.01.05.07.44.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:44: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=cOTdFLzk; 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 1rLmM5-0004O8-Va; Fri, 05 Jan 2024 10:43:30 -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 1rLmLv-0004Dv-8K for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:19 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmLt-0002x6-Lf for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:19 -0500 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3368ae75082so381998f8f.1 for ; Fri, 05 Jan 2024 07:43:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469396; x=1705074196; darn=nongnu.org; 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=dyYYg5j1yzG/KRM3hwRmq5l0B0UfdF1Z3FJP8e3OduU=; b=cOTdFLzkEqK4Mqv8v7cggaUEx+hZJ2bidv4Rq5SR6kOu9ghWEGUBjDtQ1pnvK3yCsQ amWMvG7ZOSoCs0BD/m2VvYwi4eMHrQcQ6i/VSLuBKwelJH/0SPLN7z2xLpz+mWHmZ/ZQ uUdDdMaGHxNW0ZvqOJJb8YObL8l2Kw4PtazcOG5iMDa7onFCagajUqZOt+7g7qJglorN kNh/b29oShwcIjjJl+9s2PQsXXN5yDynHC/mZAM7or3QYv+r+x9eWHvQFx4thYwYOBql cvv1p1bR6ftkdOiV4qocHo1Pfyd5dU/Odt4RBl5xmuk+XB4YS+BosOj+guX1mUb6XY+4 iL2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469396; x=1705074196; 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=dyYYg5j1yzG/KRM3hwRmq5l0B0UfdF1Z3FJP8e3OduU=; b=t8VimpZ5kprdoDBWEzU+AQogxoA2NgKY7kTdXvYKw+Xn057/f7Ep4B1bpfkiieCXQi fqMX36qugJh5HVBFrerhLWlcDr5JkaxBnTj30XO3rJfHwMrzwRJ9Api9TCgThF+IhVWp /k/3bR/fRNNIhhHu6hnJrk1K8CdUOCKsijKWtNPHf8m4JvYD8bCH7VOWfYHt6GL2APSo QeeIZ8acN4NDCIVA0/vleqr+iOp5eOctSUMvDwey4a6PojoDK5X/DXC3AD98dQ4b34w0 kjvlQNb02x2hi0GQU1XrwGYV8BAepZWGu/5eB818ZSgWlBpSWn180eZnSebpEVe79sWe NRVw== X-Gm-Message-State: AOJu0YwrYdJkA4YeLrHUuEihY3XhCCFfUyGLB80dovMtjDfZwqea/55C wcqF8c6SG+U8fbK7VsMyumnh52lY7HLwoH9gNLc0ju8DFKk= X-Received: by 2002:a05:600c:3846:b0:40e:364d:d526 with SMTP id s6-20020a05600c384600b0040e364dd526mr821960wmr.87.1704469395811; Fri, 05 Jan 2024 07:43:15 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id m3-20020a05600c3b0300b0040d91ab1d54sm1936603wms.6.2024.01.05.07.43.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth Subject: [PULL 01/71] meson: Allow building binary with no target-specific files in hw/ Date: Fri, 5 Jan 2024 16:41:54 +0100 Message-ID: <20240105154307.21385-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Allow building a qemu-system-foo binary with target-agnostic only HW models. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20231121203129.67999-1-philmd@linaro.org> --- meson.build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 5a2582776c..371edafae6 100644 --- a/meson.build +++ b/meson.build @@ -3771,9 +3771,11 @@ foreach target : target_dirs arch_deps += t.dependencies() hw_dir = target_name == 'sparc64' ? 'sparc64' : target_base_arch - hw = hw_arch[hw_dir].apply(config_target, strict: false) - arch_srcs += hw.sources() - arch_deps += hw.dependencies() + if hw_arch.has_key(hw_dir) + hw = hw_arch[hw_dir].apply(config_target, strict: false) + arch_srcs += hw.sources() + arch_deps += hw.dependencies() + endif arch_srcs += config_devices_h[target] link_args += ['@block.syms', '@qemu.syms'] From patchwork Fri Jan 5 15:41:55 2024 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: 760159 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp103511wru; Fri, 5 Jan 2024 07:44:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPbFETmjVu7VUIDVZQdgA5PUo/L9OgiQiZcQnFiUhxDDoDcw3Jj9G4jp+fAA0H60oN5/FR X-Received: by 2002:a0d:c404:0:b0:5d7:1940:8df8 with SMTP id g4-20020a0dc404000000b005d719408df8mr2249162ywd.95.1704469467235; Fri, 05 Jan 2024 07:44:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469467; cv=none; d=google.com; s=arc-20160816; b=vPrOjwfuBGpJrFrIAcAWmlabs7gO33Pb52Rg4FJy6p0uZRf6r72nQHdLs1tV0WIcd+ ijCJ1EmZKdgWWDblAJGNEZ8K36yWNUxLUhmpDZKWmR972hxr1dF3N1KRLordeLGZ79sp k8lNHqUYzm32gEWpJMqsnLUsMtvbaECG10qA2spXVDT36hK1z1kbADH2gFeiy1YKay2A WpVBdVlIkYrp42IVAkqvLSM41eToIz09/Fx10X9z9/OaLd6uja5IPz5SCkc2Q/ci0P1N lLGey9yr9OvQWyvHbhzC4oNkvff7YHizCLAR3GN5HMY6tgx4q6ncBQdyrXBxpzqe8vO7 327w== 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=ZrhO0fF/4wCYRBDkij/JpNIZFZJdEux3joJ/5vLZ4GY=; fh=V7uVG1DgPEiI/Dn5AyTMYxZqYu+WhPESNN5nDmV3BtE=; b=0f4Ic+qVkUWXn004zx38fUGWlxOTEpvKCJkDyXIegOdqIXkiBLlKZSeQC16gwp8yhS 4F6ZIWMEMPHCskWeFkh1k329E1YgKgbfmVZgzpM3DvrF2hu+pqMDLN4Cn1tqLV7jfLln +hI3jeyTnE4eEZ01ft2YoInrcZdYNarj5xtfXeh9R+/9DpcAC1smmt4T4njB98yCbBfv tTS/Z0emIkNxl3oO7KZAW44VUWPjIIjgTveDrtbDUJTdcQahfIp87luG9pQL+SreewGd r+YJXEoBYlHm2jAhCEztOVX/ECz3jM7zb5BThKHBr/mxx8tv21pB4SEUfdCgQ4RuTeDQ p0rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bwi3kpzG; 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 u22-20020a0cb416000000b0067f69b84b0asi2064648qve.356.2024.01.05.07.44.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:44:27 -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=bwi3kpzG; 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 1rLmM6-0004QK-UT; Fri, 05 Jan 2024 10:43:30 -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 1rLmM1-0004Id-Ii for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:27 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmLz-0002zA-8y for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:24 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40d5ac76667so12842245e9.1 for ; Fri, 05 Jan 2024 07:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469401; x=1705074201; darn=nongnu.org; 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=ZrhO0fF/4wCYRBDkij/JpNIZFZJdEux3joJ/5vLZ4GY=; b=bwi3kpzGGNXCOg+20oW7rcdO6hXQlCRbkxobFttj7cxuRBleMFixnF2Ffg1G7TqmrC zyWrEFwzJZGrK8EdQzJLdfazNeoKvWs7HZK2MNvl+tD56VzMbScGxjlhxq6K0NZAIP3H GIt1Fq4zu/EwWdj/2oNgAA9VaZWUBLEADJkyV34Oyt+MtzQ+plYOnI4DGDXL8SentVz0 upHwkNMV60xGHNiqhX1Bq7nmm3M+3eanaKYgES8SO3B+eS6NqQ5jw0UFfxIL8aa6EwxO YHBPIxJlKa+zxEEMbe4jnbi4w2Oy/+63Hkwin2DLwSWNVdOesNH0kVhn7t2w5Pc9YWgd Q7pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469401; x=1705074201; 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=ZrhO0fF/4wCYRBDkij/JpNIZFZJdEux3joJ/5vLZ4GY=; b=Cn/l0Q3ntTjnh7ez5KmpVWZ1ED+XoS16rJzqm3YMBJv1dyP5GHo99bpxDyZ7OWe2le HQsk2511spyUlRhL4MSJMDuJvEdGE12Jz+JOD+euyxWh3LC5xe2XgxY2ZW6IEAZLwt/2 xNt+Jdej/aiJPT1hV1J5h/ozM3ccmPYb5BDILZf8ClaW3HKo6MQFN5JEQI0XrUBWasil L1dwZexkhJPPr8Q5qNTaVHz2QF+UGSqpXMCJS+8IR6230dfmlp4F9PIIn5jVdgvyjD7m nJK+TYUXpNxVemaI0T2A9Im0q2dij03hTl78V+u/okFtPIpnd41FiJgdQEha5PgrhGES 2OBg== X-Gm-Message-State: AOJu0YwlwbvmQhgNaVb8HiBOj3094WCcyI8yV+87zOBkbVLTSIBOtdMP paRia0zJ+QJguhI3r9TePUq2ZXz74AimxZi/sCt5c2ROfb8= X-Received: by 2002:adf:f282:0:b0:337:39e3:3b71 with SMTP id k2-20020adff282000000b0033739e33b71mr1335279wro.74.1704469401108; Fri, 05 Jan 2024 07:43:21 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id f11-20020a5d50cb000000b00336ebf27d59sm1602952wrt.78.2024.01.05.07.43.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 02/71] target/alpha: Remove fallback to ev67 cpu class Date: Fri, 5 Jan 2024 16:41:55 +0100 Message-ID: <20240105154307.21385-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan 'ev67' CPU class will be returned to match everything, which makes no sense as mentioned in the comments. Remove the logic to fall back to 'ev67' CPU class to match everything. Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-2-gshan@redhat.com> [PMD: Reword subject, replace 'any' -> 'ev67' on linux-user] Signed-off-by: Philippe Mathieu-Daudé --- linux-user/alpha/target_elf.h | 2 +- target/alpha/cpu.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/linux-user/alpha/target_elf.h b/linux-user/alpha/target_elf.h index 344e9f4d39..b77d638f6d 100644 --- a/linux-user/alpha/target_elf.h +++ b/linux-user/alpha/target_elf.h @@ -9,6 +9,6 @@ #define ALPHA_TARGET_ELF_H static inline const char *cpu_get_model(uint32_t eflags) { - return "any"; + return "ev67"; } #endif diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 39cf841b3e..91fe8ae095 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -141,11 +141,8 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(ALPHA_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - - /* TODO: remove match everything nonsense */ - if (!oc || object_class_is_abstract(oc)) { - /* Default to ev67; no reason not to emulate insns by default. */ - oc = object_class_by_name(ALPHA_CPU_TYPE_NAME("ev67")); + if (!oc || !object_class_dynamic_cast(oc, TYPE_ALPHA_CPU)) { + return NULL; } return oc; From patchwork Fri Jan 5 15:41:56 2024 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: 760154 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp103291wru; Fri, 5 Jan 2024 07:44:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCb0hljnBULOOuqct7R4kGe8PIZR8S2Jzm14Xtv8RBkB8PhowAVKJAHfklRDAMoWbSbmTB X-Received: by 2002:a05:622a:1908:b0:428:1b1d:7f99 with SMTP id w8-20020a05622a190800b004281b1d7f99mr2369688qtc.21.1704469440256; Fri, 05 Jan 2024 07:44:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469440; cv=none; d=google.com; s=arc-20160816; b=G1CdIdKUR2o6QIkuW28e1ftKSawnCDjkQHV4wbfoc9qzCx4tcUeWpp7kceuB0ydMAK bB8k1GItQxDa8GT1SmHBjaUk6Mk6j372LdfyZmlevtSyoGzFiVtqvBjr458bnqF4ifI9 eO6eHYMPMjbyqWtZBM0dBP6lTNQ34EqynkBcnys7jM2YI2lMHbSC7mOA0cbJ8MHYwjuo E6gRcE4IynqojhIsePblAhVGBtmnMwaLQYLG6TevlR17rweC/An0FN0TMSLVfD5M0ATi /cUg6vg2uyc4I9drnmxI2C73IsnK7w6/B5yAwWfJ5+01ziwiIVjqIMg6n3yHR2UipOc2 57YA== 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=kfCx4/gtR4YY4ivQoLXNfOFMl7NDjjAvmzs8gXTbe8k=; fh=gTmaJj2E1hs4HyEUKXnyq8OKcC/EaIkRfqHsQQPBpKE=; b=IGvcpV0YhJJvDVP7tuy+y1p8eDfR22Nsw4Q8UeNxVGVggCfsOLpumPBAX8X16CeEaI zFVm8t8G00hJJfi4ODW9wv+1qezHWKUIc7/Na8eviEJyB5sk5t+kRcNFcrqQkqXv05aN 9aqIL8x6fz3m47A7u/Kgu40/CSDLO4p+uGC0ZAQN+vsJayINW863Pxd/xKq9t3kPUtG+ DdIVYll3BHY6IG3N70mlHmJAPv6K/Xv5nUCL+1AtSsZlh7hafL3mYhcFE7nCy6/F5N59 9SL6sBn0wn4aI0uS2YN+PgtqEtszdOTWG3QJBKrK2cbH1NM8BdaHXsUF184CTFWZV+Gi O6Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pUhC2F9f; 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 c6-20020a05622a058600b00429762222a4si2055900qtb.741.2024.01.05.07.44.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:44:00 -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=pUhC2F9f; 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 1rLmMJ-0004YE-2D; Fri, 05 Jan 2024 10:43: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 1rLmMI-0004Xg-48 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:42 -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 1rLmM4-00030R-1H for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:41 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40e3b43173eso2006805e9.1 for ; Fri, 05 Jan 2024 07:43:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469406; x=1705074206; darn=nongnu.org; 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=kfCx4/gtR4YY4ivQoLXNfOFMl7NDjjAvmzs8gXTbe8k=; b=pUhC2F9fWeiAW4HljsTiPYeOoM69zTLlFisGRC9T5nR52G8chwGncaBbHWAs4owznH yJ76w7XWpHvcLa0nVeDSPjO6g9rE0dC+dxreiuOwGj1K1mL48DnScxHs4zV2iXg1cs8F 6fYfuLxJlcrNM2LAbcr2zzJWuKlFVLEup2UhiZxifxK2hyKjFYnK0cnSFWes713vrG8D Jmxu5paBVlQ3DbqPYpoMhdyJ9k46T1jIBg1DrFmu7mHMtKftw0IOWbn3EJtowPkgTdWY fQONH2H9w21hXWsFPNX0s3lXFvvSCIbTBfaSwCOBTxwoefeR6n2C7n1XkdP6YXvq06Ao h0hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469406; x=1705074206; 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=kfCx4/gtR4YY4ivQoLXNfOFMl7NDjjAvmzs8gXTbe8k=; b=G6xi6WSyaorV3279xGk0avnqDEszfPWeK1HWebTBKBtF0JJUgkDTauhMiIcXh1IKjn qk3pwV6XV531oLcBmoR9Plg9xCa/iW1PAkcX3CCExlDL5G3lbWInPKCQ35UF3RhSvmM7 7Sxo9vaWVt5m8Eu6yLttQWnluRMltABDx3xHz6MasxDI93ygjHTEt+2CvZ6o/OvUGxIe YGwtBDMC1zE7LU2L2lC6ZP6wkr8jqz3lbzjLUbUiRF+2AHnvUHFeVlAkCquQG9mqCivl bCh4yHJrGfBReFIWarUFTrozwe/9SaKVG7qYy/A15YciD3eNQsKW4nRM2GBD6sS6gY29 UYzQ== X-Gm-Message-State: AOJu0Ywv/PLwCnjpnoaLv3gnypYlwq3tap4TiAb5ugm76pXfx9bhgqaY BH42UMr39Bo0L+E+OoQIxACELRl8+hTfLgUS8k/cHv+B5Xw= X-Received: by 2002:a05:600c:1910:b0:40c:91f:506e with SMTP id j16-20020a05600c191000b0040c091f506emr829441wmq.126.1704469406291; Fri, 05 Jan 2024 07:43:26 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id j26-20020a05600c1c1a00b0040e3804ea71sm1941923wms.10.2024.01.05.07.43.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 03/71] target/hppa: Remove object_class_is_abstract() Date: Fri, 5 Jan 2024 16:41:56 +0100 Message-ID: <20240105154307.21385-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Since commit 3a9d0d7b64 ("hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name()"), there is no need to check if @oc is abstract because it has been covered by cpu_class_by_name(). Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-3-gshan@redhat.com> [PMD: Mention commit 3a9d0d7b64] Signed-off-by: Philippe Mathieu-Daudé --- target/hppa/cpu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 04de1689d7..e3e7200b1d 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -162,9 +162,7 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model) g_autofree char *typename = g_strconcat(cpu_model, "-cpu", NULL); ObjectClass *oc = object_class_by_name(typename); - if (oc && - !object_class_is_abstract(oc) && - object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) { + if (oc && object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) { return oc; } return NULL; From patchwork Fri Jan 5 15:41:57 2024 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: 760156 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp103294wru; Fri, 5 Jan 2024 07:44:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXakSnYbW+jPR59v6YsOaGjbXASSqOmHPrRzMVANg6NUQlex5X6h55kW2DzO0mZYU8uUHT X-Received: by 2002:a05:6870:2248:b0:204:b89:69e6 with SMTP id j8-20020a056870224800b002040b8969e6mr2569951oaf.106.1704469440453; Fri, 05 Jan 2024 07:44:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469440; cv=none; d=google.com; s=arc-20160816; b=Gw1stLPCL4+s+xGnKxmz8RgpxDAzELP9z1QsL0gVoRoAiWHroTaz0Cg3JVFdmM1rUt /hKvbbVMQtH1nFPV3LtXL26wcgUZjctWBwEwYdR1gTVZWcdQ2u1Cd8193oKr+MkyqhTC K/RY1PZDJtWNWNxKCYor/U/QWh19qecuFMYeNsZbalL5JHGpYGZSV+2ksrvkMBBaUKyW SI8wWP/0JyZDhO6Z6muc+RcKpylIDEc/KVoBgiECKcLJAhtlw5n4j1NXUlI8yBoKo5wJ 8pBSr/Zzt1Cdxs09NSMkD5drzIDqG4vp1wAl25eGppLYW4TFHpbbnpPPse1u/9IXCBVE 7+sg== 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=/gOHeYXZaENDpXVCc7dFmhih0x0gAZTHQNBrKsITHc4=; fh=mp1QisbMzD3WGnBsnTu2VzBtBm6Z6g4we33B+2s0mSY=; b=g3DnPhHYMCdt7wrj6SYHw33Q7tNKYUTFgvu/+oIDhj5/vZLdDaRhZ9P/dN7df5gMmR 6AayvJJG9apQdj05CnQsLlqjJwb9dEjiaYdNdZJ6K5lig/MaStjLbPDX0WKNq/enU/Sc U/j/mtolXXYwk3vXDKGl+YgWSBCQFfQ7njoIZeTVUGqu9SFr9w7V0VbVPMgmN3ac5W9q 3sHUVP7zglO5lZhKJeb/eiMLceAag2eateoTQOAZImgT0OqWobZJWdUGNG1ov99L8S8p erps5cAItE6hrUmBbxxyxs5vuI1n2Z47mMkGMrncNZOyOF2npgcWU0S2iG5FnELGtbhu vyyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y8mQE3h2; 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 e14-20020a05622a110e00b004280329c06bsi1964843qty.118.2024.01.05.07.44.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:44:00 -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=y8mQE3h2; 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 1rLmMF-0004WV-Mt; Fri, 05 Jan 2024 10:43:39 -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 1rLmMD-0004VC-N4 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:37 -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 1rLmMA-000322-2P for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:37 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40d8e7a50c1so18915465e9.2 for ; Fri, 05 Jan 2024 07:43:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469412; x=1705074212; darn=nongnu.org; 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=/gOHeYXZaENDpXVCc7dFmhih0x0gAZTHQNBrKsITHc4=; b=y8mQE3h2tzrsIz9htvdngU0RPnnNiPdLIrqgWqaN6zRO47rzMwoKvm5cUHjzeZaJHc m5Uvixz/uMz3WDg2AGXQMhBOo44yPq+1pIRbfr67y2cRjhPdwm0vrxKoQHHzcY9ygT0p i0XxSCdWtlTrNuPm5b6aJOUzd1Ab6y5XIGpjFBCeDnwHAXEaDBDw8DzUOb59Y4l6d48U TkXCaYnQ8qj+T11tPJqz4hOWQpgjJeeaLIbhkrNzCWYwdgUGMQuFos24M2pKTrnqKGbc i1Eh6AfjOH2Np8HwEz9g74nu/Y8GD1LCg4Dd0LVHhksQ+kCsbQfyss0H4VT8AjwQ2eth kWGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469412; x=1705074212; 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=/gOHeYXZaENDpXVCc7dFmhih0x0gAZTHQNBrKsITHc4=; b=jsMHQLOT3TEOAcSQDl58CNd1VZgQIPdG9bTLWViJIBMfx0tj9VgdUUyLVvhw6VbkpE nulzU5X1bLaW/9QuCr0/ccdkNvgYMKRL9uU7qHRxK6bCPsrGqeqNEjc8KEBS5MyToCaz sx2Zrp4KaLdUbg+UTFJzV97+0+mKr/UYLZgcz6TXQph7UV/DOe/H/VoXr9BKOwp2N9pV yRdPyvmShPQhFtsDcFI83WzSJqAiULy6VILQxxpq9sDzSHsMjyM0HL5W3XOxsD1VV2kY E/ljow6k/HbZs0XDqkeeToyNl8TrCwAdQeR8L46+tadNQ+nvW7CrzKGjMQrnP9rxH+Fk MxTQ== X-Gm-Message-State: AOJu0YxLNHV1a1XyrRjKRexfnI6DdSr3TcOspChnwGyRNRLpTJD5N2Yl GjGFopDx5BsErpE4xvJIWTaLFjSbHFBtT6+qtypFDgAemzU= X-Received: by 2002:a05:600c:470b:b0:40d:5c50:573 with SMTP id v11-20020a05600c470b00b0040d5c500573mr1142490wmo.213.1704469412529; Fri, 05 Jan 2024 07:43:32 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id i1-20020a05600c354100b0040d8ff79fd8sm1938104wmq.7.2024.01.05.07.43.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gavin Shan , Igor Mammedov , Richard Henderson , Peter Maydell , Michael Rolnik , "Edgar E. Iglesias" , Brian Cain , Song Gao , Laurent Vivier , Stafford Horne , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Bastian Koppelmann , Max Filippov Subject: [PULL 04/71] cpu: Call object_class_dynamic_cast() once in cpu_class_by_name() Date: Fri, 5 Jan 2024 16:41:57 +0100 Message-ID: <20240105154307.21385-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 For all targets, the CPU class returned from CPUClass::class_by_name() and object_class_dynamic_cast(oc, CPU_RESOLVING_TYPE) need to be compatible. Lets apply the check in cpu_class_by_name() for once, instead of having the check in CPUClass::class_by_name() for individual target. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Gavin Shan Reviewed-by: Igor Mammedov Reviewed-by: Richard Henderson Signed-off-by: Gavin Shan Message-ID: <20231114235628.534334-4-gshan@redhat.com> --- hw/core/cpu-common.c | 8 +++++--- target/alpha/cpu.c | 3 --- target/arm/cpu.c | 4 +--- target/avr/cpu.c | 8 +------- target/cris/cpu.c | 4 +--- target/hexagon/cpu.c | 4 +--- target/hppa/cpu.c | 6 +----- target/loongarch/cpu.c | 8 +------- target/m68k/cpu.c | 4 +--- target/openrisc/cpu.c | 4 +--- target/riscv/cpu.c | 4 +--- target/tricore/cpu.c | 4 +--- target/xtensa/cpu.c | 4 +--- 13 files changed, 16 insertions(+), 49 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 82dae51a55..d0e7bbdf06 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -154,10 +154,12 @@ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) assert(cc->class_by_name); assert(cpu_model); oc = cc->class_by_name(cpu_model); - if (oc == NULL || object_class_is_abstract(oc)) { - return NULL; + if (object_class_dynamic_cast(oc, typename) && + !object_class_is_abstract(oc)) { + return oc; } - return oc; + + return NULL; } static void cpu_common_parse_features(const char *typename, char *features, diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 91fe8ae095..83345c5c7d 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -141,9 +141,6 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(ALPHA_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (!oc || !object_class_dynamic_cast(oc, TYPE_ALPHA_CPU)) { - return NULL; - } return oc; } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 650e09b29c..1c8b787482 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2411,9 +2411,7 @@ static ObjectClass *arm_cpu_class_by_name(const char *cpu_model) oc = object_class_by_name(typename); g_strfreev(cpuname); g_free(typename); - if (!oc || !object_class_dynamic_cast(oc, TYPE_ARM_CPU)) { - return NULL; - } + return oc; } diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 999c010ded..3e478294a6 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -160,13 +160,7 @@ static Property avr_cpu_properties[] = { static ObjectClass *avr_cpu_class_by_name(const char *cpu_model) { - ObjectClass *oc; - - oc = object_class_by_name(cpu_model); - if (object_class_dynamic_cast(oc, TYPE_AVR_CPU) == NULL) { - oc = NULL; - } - return oc; + return object_class_by_name(cpu_model); } static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags) diff --git a/target/cris/cpu.c b/target/cris/cpu.c index 675b73ac04..a5083a0077 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -95,9 +95,7 @@ static ObjectClass *cris_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(CRIS_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (oc != NULL && !object_class_dynamic_cast(oc, TYPE_CRIS_CPU)) { - oc = NULL; - } + return oc; } diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 9d1ffc3b4b..aa48f5fe89 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -63,9 +63,7 @@ static ObjectClass *hexagon_cpu_class_by_name(const char *cpu_model) oc = object_class_by_name(typename); g_strfreev(cpuname); g_free(typename); - if (!oc || !object_class_dynamic_cast(oc, TYPE_HEXAGON_CPU)) { - return NULL; - } + return oc; } diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index e3e7200b1d..1a5fb6c65b 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -160,12 +160,8 @@ static void hppa_cpu_initfn(Object *obj) static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model) { g_autofree char *typename = g_strconcat(cpu_model, "-cpu", NULL); - ObjectClass *oc = object_class_by_name(typename); - if (oc && object_class_dynamic_cast(oc, TYPE_HPPA_CPU)) { - return oc; - } - return NULL; + return object_class_by_name(typename); } static void hppa_cpu_list_entry(gpointer data, gpointer user_data) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 07319d6fb9..81f2d8d8ed 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -718,15 +718,9 @@ static ObjectClass *loongarch_cpu_class_by_name(const char *cpu_model) g_autofree char *typename = g_strdup_printf(LOONGARCH_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); - if (!oc) { - return NULL; - } } - if (object_class_dynamic_cast(oc, TYPE_LOONGARCH_CPU)) { - return oc; - } - return NULL; + return oc; } void loongarch_cpu_dump_state(CPUState *cs, FILE *f, int flags) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 43b1bde21c..1421e77c2c 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -111,9 +111,7 @@ static ObjectClass *m68k_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(M68K_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (oc != NULL && object_class_dynamic_cast(oc, TYPE_M68K_CPU) == NULL) { - return NULL; - } + return oc; } diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 1173260017..f7d53c592a 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -164,9 +164,7 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(OPENRISC_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (oc != NULL && !object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU)) { - return NULL; - } + return oc; } diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 83c7c0cf07..523e9a16ea 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -646,9 +646,7 @@ static ObjectClass *riscv_cpu_class_by_name(const char *cpu_model) oc = object_class_by_name(typename); g_strfreev(cpuname); g_free(typename); - if (!oc || !object_class_dynamic_cast(oc, TYPE_RISCV_CPU)) { - return NULL; - } + return oc; } diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 034e01c189..8acacdf0c0 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -132,9 +132,7 @@ static ObjectClass *tricore_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(TRICORE_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (!oc || !object_class_dynamic_cast(oc, TYPE_TRICORE_CPU)) { - return NULL; - } + return oc; } diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index e20fe87bf2..93e782a6e0 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -141,9 +141,7 @@ static ObjectClass *xtensa_cpu_class_by_name(const char *cpu_model) typename = g_strdup_printf(XTENSA_CPU_TYPE_NAME("%s"), cpu_model); oc = object_class_by_name(typename); g_free(typename); - if (oc == NULL || !object_class_dynamic_cast(oc, TYPE_XTENSA_CPU)) { - return NULL; - } + return oc; } From patchwork Fri Jan 5 15:41:58 2024 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: 760165 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp104980wru; Fri, 5 Jan 2024 07:47:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRdd1FfLrYfjxNc+gd9rXILXYrA338EsF8gKopHn91BbQlZPn85Tbgy6FZg9ctzS1rxW7j X-Received: by 2002:a05:620a:1276:b0:783:9bb:963c with SMTP id b22-20020a05620a127600b0078309bb963cmr918801qkl.90.1704469656675; Fri, 05 Jan 2024 07:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469656; cv=none; d=google.com; s=arc-20160816; b=ACbBB026Oo0aFR0fam80HSDwXnfdatfHWsMGcd1JZNChgzDKA3X2HMkxIGXpbdDkVS tSwzigN5LKDMW1nDBtHAi5ormFkJLuZhrytB0exemcb3UUXADTR0zEAbkrQLb3ivSLQy OD0mqToik4hLDGgO0R63cmUc4VJYDRd9uhH6eAHNHMqxtfZPVUrNLN2aNiK0ggspiR65 wvlBeKgYHT7n3nwqOIdMnkYMAcr1K7GvSYjQmMt64VTAMex59sYh+eZxpWcfWiPYTO6j qC2FMOYMU2BmqtCOUAVkI3hPd2EKqp6oWfmPS0LtWQvXHTRdZe9hDRdP6g101iGyxrFm FY6g== 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=ryursiHqH68ZqMgSdIiqgs1dXkhwVe0KhUL0m3rAt/Q=; fh=0elr7oOoKfORub8uK/pZAVpdgL0ap5d0Iqya8Kfg/4M=; b=ypwYpeQLrOUtusRIKAYES8jZxPW1WxsE8NZbHEFFUSqBtc0rI5FK1EKr9Qed4Qr1rc uGE5LiO6GqnLXIUKJFyWvHpnYUzxn32UZ2HpJN911E0a5skpRiIQzw15GjYbxouoPcOK AiUUAeo1fvmgbKLVtlK1iTGf7L/U1sK5Jl4EkpZx6W42J23Sg06GewVAQSX4RvMAifTB 3Qq+K7/jtLVrlhDjmTv+LeXbczBPV7LD+D7NBdtkqq2Qqz+uE7lvEikyCqYdmYxUiu9y 8rk8u8D5uY3p+/pJGqIJxNWe5NJOiWdOVuRNU7vm4wh4t4f3TS6TDLaBhlQfGbmJmoW3 VLUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cmpwsCxD; 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 e1-20020a05620a014100b007819125fa4asi1872671qkn.229.2024.01.05.07.47.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47:36 -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=cmpwsCxD; 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 1rLmMN-0004Zd-4Q; Fri, 05 Jan 2024 10:43:47 -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 1rLmMK-0004Yl-5V for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:44 -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 1rLmMG-00034E-IN for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:42 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-336746a545fso406959f8f.0 for ; Fri, 05 Jan 2024 07:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469418; x=1705074218; darn=nongnu.org; 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=ryursiHqH68ZqMgSdIiqgs1dXkhwVe0KhUL0m3rAt/Q=; b=cmpwsCxDhwSGwMBLgEsmuqTLxYgA0itMEmKdxRtSKEMzV35Vd9hsHv3KejuodOfaPD axmk7Kc/Od9PYmTswgwB0argHEFOwMdquTwYLUYqlnud+zvFplJ5ChFQX91y9oangfMj NmdX4SfsN7V4TRs4jvo0BXjnSZbsbyqYU0BP847WnCnJGZxt9IXvqUbznJ8AyOtHNlYg 4Z4jD+WeuOG8xFOLeEMbNw7xe5oOuPjkY6F0PJ1ZTQ7MXZ8T0gCdxU2avzNLGbQ4xtKy VC+XY0MC9VG9qot/a8hV5HENUCzSOmTljqfZjDOlrOGCBTqCFKq8fkJ9aQDCiVCujQd+ 75qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469418; x=1705074218; 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=ryursiHqH68ZqMgSdIiqgs1dXkhwVe0KhUL0m3rAt/Q=; b=AKE0TmK3fK1JE/8J6dHa3t/S5nmh/qkbeyddqMuYZ7nu4K+JP4Fix3me41cZfR/Zx7 9f5UqHu8GELGHOij9vkM1JhDZBPR42umt3fYT+FAGIjxzHZZZV5sw6/pAtzTxbTvQZCu O2yW4UDVbZwnhDtHcWTMNA64F1J6Clg966/O/njb9Olmqn5wKJlipJ129Uwnz/RP2wjs 9LQGH1sK8ZhXy/DykTEBc4u77WnMxCm5tIBrxk9VwsZ21SfWeW0e0E/EVwKMawJ1JyuT ZpGqjLfdgu+PKuMr6iAnVfZaFEmqxNtFNzbhsqeCV26U2o4bHpSNgcgja8AorvEGw8g6 wEBg== X-Gm-Message-State: AOJu0YyjPp+DooiYYR8oo9Tz6hObavGTxioKEaAFAZOGZMuJ1ZEKqIFC UIEkUIrjja/RYY25kyyETrMTclR2xoY/oMQLBwzovIP4F8I= X-Received: by 2002:a5d:6104:0:b0:336:68c1:36fa with SMTP id v4-20020a5d6104000000b0033668c136famr1330955wrt.5.1704469418064; Fri, 05 Jan 2024 07:43:38 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id q9-20020a05600000c900b003367eae8e18sm1613962wrx.57.2024.01.05.07.43.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 05/71] cpu: Add helper cpu_model_from_type() Date: Fri, 5 Jan 2024 16:41:58 +0100 Message-ID: <20240105154307.21385-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Add helper cpu_model_from_type() to extract the CPU model name from the CPU type name in two circumstances: (1) The CPU type name is the combination of the CPU model name and suffix. (2) The CPU type name is same to the CPU model name. The helper will be used in the subsequent commits to conver the CPU type name to the CPU model name. Suggested-by: Igor Mammedov Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-6-gshan@redhat.com> [PMD: Mention returned string must be released with g_free()] Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 13 +++++++++++++ cpu-target.c | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index c0c8320413..76ef59de0a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -779,6 +779,19 @@ void cpu_reset(CPUState *cpu); */ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model); +/** + * cpu_model_from_type: + * @typename: The CPU type name + * + * Extract the CPU model name from the CPU type name. The + * CPU type name is either the combination of the CPU model + * name and suffix, or same to the CPU model name. + * + * Returns: CPU model name or NULL if the CPU class doesn't exist + * The user should g_free() the string once no longer needed. + */ +char *cpu_model_from_type(const char *typename); + /** * cpu_create: * @typename: The CPU type. diff --git a/cpu-target.c b/cpu-target.c index 430dc53566..6f4afc1dbc 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -241,6 +241,21 @@ void cpu_exec_initfn(CPUState *cpu) #endif } +char *cpu_model_from_type(const char *typename) +{ + const char *suffix = "-" CPU_RESOLVING_TYPE; + + if (!object_class_by_name(typename)) { + return NULL; + } + + if (g_str_has_suffix(typename, suffix)) { + return g_strndup(typename, strlen(typename) - strlen(suffix)); + } + + return g_strdup(typename); +} + const char *parse_cpu_option(const char *cpu_option) { ObjectClass *oc; From patchwork Fri Jan 5 15:41:59 2024 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: 760158 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp103361wru; Fri, 5 Jan 2024 07:44:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGG+yZmiqGfEA4IqaO2ZwXfL5S1IN3ONIJzb42hWWYDph/9PiE8sUmmfHcT9ECyUpQtCp5F X-Received: by 2002:a05:6359:3203:b0:173:ab53:5e3c with SMTP id rj3-20020a056359320300b00173ab535e3cmr1790700rwb.45.1704469450463; Fri, 05 Jan 2024 07:44:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469450; cv=none; d=google.com; s=arc-20160816; b=U3N7o1ZWEkIoggvXDg1tcWztiB9eCbYzppKpX0oHnv5ZP93ggFBl2O6OrEzdNWKJVb EZD+IaH8uHUmUIKF3eyef2U4aCZA3//bXYvkvIL7JUF1lnvzh7kun5TvKP86+57oMitK GYOEWizFoHBMCo7tGn3B9liRI5u1nGwoT7HQ25clFwX9yjUo3cMEUBmuA+z/W0jV7P++ zg5Fa1xZ27piLkuZ6ocXKb5+Y38w7VkxpeWXr6HBcCgfchxaaN7zpyDZdHpIik5mbuYT hXEuV3/khQhJW4E12wpYUaHWvzmxWv+s08yDuVE3ZCdKHNIsNc+m06YjDqVOJBZxImT3 O3Nw== 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=kIbpZfgL2GdYvVTJqmdprGQ276jFAcijx1XENXuPWGk=; fh=u6W3mmLrisdBuidGjeI1HoXS3a4uZ8ywWPZoWAE1f3Q=; b=dDCDwbkoBN64TUlM2eT6cqj1oafyFOQ+YL7SUrbUbbJDFwsny60PH2rXC+sfda/23m iqd7t0rulTvpZE/Wr1exgtHrXHPacMUE/P4n7xa1Fom9mwwun1SBRKRZnabLuA+lJDLl H+lKgBvfrFcDt8GbfAAJbEPE72RECCXdWqdq46kjGAPWtVTpo3EH34WH9PHBXGfInrxx kQiZcq3TAM7HhJ3xx2OGD8msgKUh89JStTqCtQmywkmUd/vlJ/RpN/F46HioQcKCe74Z 42oicOsFE7W9RQFi43AcXbqp7ovyXdWLJ80Fjzleurqpl5jKfIs9BvqgCx5FEeNvW9A6 9MJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="kddC/ty8"; 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 h10-20020ac87d4a000000b004297d67073fsi382606qtb.406.2024.01.05.07.44.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:44:10 -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="kddC/ty8"; 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 1rLmMP-0004bJ-TL; Fri, 05 Jan 2024 10:43: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 1rLmMN-0004a6-RQ for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:47 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmMM-00037b-37 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:47 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40e37524fafso8903105e9.1 for ; Fri, 05 Jan 2024 07:43:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469423; x=1705074223; darn=nongnu.org; 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=kIbpZfgL2GdYvVTJqmdprGQ276jFAcijx1XENXuPWGk=; b=kddC/ty8CGTqJHmRGxs5FvNNFEcQOb84m/dtAls4cZS1vrL72cla8RnZUPhDu3FA1v lMTAVCyoqh1Y0/EoZHyj99u9DFo+r3/9zUWrziuMajrFA7rXHyC6TkhAmCqMBVNXQGf9 cRd6dNbmVOFeoHoGbPzAGq2zf0RjwODlvjOEZhOHqn/zDMYmVjx1UE49AQjF/vKqFK9M BsD1bAbq52gGJa1nAQTxzhWrjbqQjjpux2nS8ItoEaKDttlSMi80sqc5dLgYiNm1Covs Yg3K0ae3Bfhld5h0lIlslHeZUMqbMPfsBwwko4051LsiGfGcn5lBEywalkEEDCqlZjte OWnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469423; x=1705074223; 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=kIbpZfgL2GdYvVTJqmdprGQ276jFAcijx1XENXuPWGk=; b=fhfQ3moP49wyo5RmYoLD2Eho7FhBQTPbPSc4P8IivwgXm/D2MLdsx7ArJw6ntdVdHb 3xBQ8CnQKC/PZTLKoPEtGvpczdzduZg4mjacLHSfzQrUlyLst+Cv091SrC9lnqh3yr7S FkqUT6bXJaGypsCY1W2MObk2dyloXKcR3QtpWAmYEq0Pua+qwROM23pVJU/v4HXESWoZ pYHTbo7BlDp304PSOs1MJb5VZlf3v93L3L6Nwz+Q9iYQSGMdTABV3R7Ky7Ht/NC5slI0 xqFtfhXJCqzrtiPabEpWFAL7PUG0U7SD0jpdLJV2hc/MAvaHWJVx/FnW9wX2iehPX3Yc qriQ== X-Gm-Message-State: AOJu0YwFyXf30I274fUxVTYf3OQutnPFptrYVlf1jZm4DoY6NgyiDGGQ UrjZgFVMJSQTWcib4KbxY5+cILXf9OU16Hlr1dNASGGJhsU= X-Received: by 2002:a05:600c:4e8f:b0:40d:9238:df50 with SMTP id f15-20020a05600c4e8f00b0040d9238df50mr1269643wmq.81.1704469423467; Fri, 05 Jan 2024 07:43:43 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id u14-20020a05600c19ce00b0040d5ae2906esm1929189wmq.30.2024.01.05.07.43.42 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:43 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Warner Losh , Kyle Evans , Paolo Bonzini Subject: [PULL 06/71] cpu: Add generic cpu_list() Date: Fri, 5 Jan 2024 16:41:59 +0100 Message-ID: <20240105154307.21385-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Add generic cpu_list() to replace the individual target's implementation in the subsequent commits. Currently, there are 3 targets with no cpu_list() implementation: microblaze and nios2. With this applied, those two targets switch to the generic cpu_list(). [gshan@gshan q]$ ./build/qemu-system-microblaze -cpu ? Available CPUs: microblaze-cpu [gshan@gshan q]$ ./build/qemu-system-nios2 -cpu ? Available CPUs: nios2-cpu Suggested-by: Richard Henderson Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-7-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- bsd-user/main.c | 5 +---- cpu-target.c | 29 ++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index e6014f517e..4de226d211 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -378,10 +378,7 @@ int main(int argc, char **argv) } else if (!strcmp(r, "cpu")) { cpu_model = argv[optind++]; if (is_help_option(cpu_model)) { - /* XXX: implement xxx_cpu_list for targets that still miss it */ -#if defined(cpu_list) - cpu_list(); -#endif + list_cpus(); exit(1); } } else if (!strcmp(r, "B")) { diff --git a/cpu-target.c b/cpu-target.c index 6f4afc1dbc..5eecd7ea2d 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -24,6 +24,7 @@ #include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "qemu/error-report.h" +#include "qemu/qemu-print.h" #include "migration/vmstate.h" #ifdef CONFIG_USER_ONLY #include "qemu.h" @@ -283,12 +284,34 @@ const char *parse_cpu_option(const char *cpu_option) return cpu_type; } +#ifndef cpu_list +static void cpu_list_entry(gpointer data, gpointer user_data) +{ + CPUClass *cc = CPU_CLASS(OBJECT_CLASS(data)); + const char *typename = object_class_get_name(OBJECT_CLASS(data)); + g_autofree char *model = cpu_model_from_type(typename); + + if (cc->deprecation_note) { + qemu_printf(" %s (deprecated)\n", model); + } else { + qemu_printf(" %s\n", model); + } +} + +static void cpu_list(void) +{ + GSList *list; + + list = object_class_get_list_sorted(TYPE_CPU, false); + qemu_printf("Available CPUs:\n"); + g_slist_foreach(list, cpu_list_entry, NULL); + g_slist_free(list); +} +#endif + void list_cpus(void) { - /* XXX: implement xxx_cpu_list for targets that still miss it */ -#if defined(cpu_list) cpu_list(); -#endif } #if defined(CONFIG_USER_ONLY) From patchwork Fri Jan 5 15:42:00 2024 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: 760160 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp103540wru; Fri, 5 Jan 2024 07:44:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIyn3GIE+2EymLunoLoSI5n+2pR3HCJ9IXjHhQqfxDmuXqWTAXDtqQKmMHBFeykjPnehKy X-Received: by 2002:a05:620a:13e8:b0:781:d8e1:d545 with SMTP id h8-20020a05620a13e800b00781d8e1d545mr2317331qkl.149.1704469474384; Fri, 05 Jan 2024 07:44:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469474; cv=none; d=google.com; s=arc-20160816; b=VwIfaSWY9iXuXME7mPcXEs7kZeDWt1FK3yPrB/GLQdaCeTmWCEVFcEd5hjLT2Od1rJ xe3va+fB0L331JpfbdLU7TLv295Mp1rocxuwt/+c1QF91C1CHUfbydBmwx/5buXRzXbV k1a3PrKPCqLzfZBaZvdeTExYE0JGG77e4dk46xqDcGbgit4G0qGiBEG38kKH788JkCnV 55DafbGq5ngVw/xW9uBm0EvX86BeTlY2CWhXw5VDtIRJSX2pLL6HtP/dm+cQfdbm/cXG shSi32USvlcRHBc96LQ/qw8ZVhIVBHfC1mmyJtCwW0aODcnAmH5N2t1cLMPxzIFuoNHd 4isA== 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=rLV8uDs3E9nSqverOGkh+8mNeXXqUDlTZQBJE1rP3g0=; fh=E3k/bJOAyn8KVkDcw46+fm61XnY03SPmE0lR/AkVOTI=; b=WXTht01Pgx47aTn2oHS8NrNMT63QfRDsaSqZQQEwgk8wnt4uJ2+IwmIe7rLdvyinew MVOv8RZsi3y16M30LptoAKu1819PW4/K1Y9lXNUXAn5nLMjM626GBxQbDzbDLlQV5Giu er6XPjortuQ1PpdJqsHNeqRxB1+b6NFaKjb9glpib9LvvcL2eWb55t6XsdP8l0it9koo WR+WGtxRrPfXQoIT2MtypBSxV13ZxwMbvn+aSkLvqpui/8Z1UfMZevY+U2Mt4aSln94k RzmKO4b2wrCZdhxfVaGwQPA1+nUgwG/uDD7s/BxQMhvt249WrHPRLhC314ecBjiy49RT Cbrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SKcVvpLX; 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 qr12-20020a05620a390c00b00781a6a36157si1997656qkn.653.2024.01.05.07.44.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:44:34 -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=SKcVvpLX; 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 1rLmMU-0004dk-7H; Fri, 05 Jan 2024 10:43:54 -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 1rLmMS-0004cz-F5 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:52 -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 1rLmMQ-0003AO-9J for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:52 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40d858c56cbso19526265e9.2 for ; Fri, 05 Jan 2024 07:43:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469428; x=1705074228; darn=nongnu.org; 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=rLV8uDs3E9nSqverOGkh+8mNeXXqUDlTZQBJE1rP3g0=; b=SKcVvpLX5hYD/oCShDsCadOdmGIZpC29ktiYlOnsidG8LcdFmOvFmSH1QEuhh/qESa YYPGBWkW2a1rPzYYFglCaIbw7bnOZJw0joqB5Kudwh1BN3duuCilg9ORZ4/nGBnXCjA5 BKZKh9/wDUHQIbVidQMa9V9a6t/iO9S+jU7y4NC9ecaLfJxJ/0uOaoffaKvLR75JTPJt +IpnIYY5Cdtv3zgFUSH1U3xry7p0AYApE0oc9BCO/SAavCZaIv9RUgjp2ARlmcKOwB9T vxjD/J/1iAdHvdCqXWaKzR3pb0QbEjR4EFELolDRJAFV7ufficbheNvpRmMPHhto/OXv KjNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469428; x=1705074228; 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=rLV8uDs3E9nSqverOGkh+8mNeXXqUDlTZQBJE1rP3g0=; b=naGuM6t1v4v1oqIDrss44Mm9+iNDrU4orwTFC1qW8D6/GjZ064ga140FimuAxj+hBD ptLlDo5F1V/f9+KddI5Z61ETODKu/Vcu5NvlEN7jgjwtWka3jm3a3/kvaDFJ9RNKr/ow Jm+Oc5Kq+jdOzrDqbR+7f4mCG5UCaxyDf9Vjo7hF/V5Z06HbfHVlVcInDitBEP8GwREt ieS9XNN36pg9DQYbHyulGjQdIz21SujewSudTcO8N5rIRi2agit/hxFWHzFGWcDVLnng xRHJ+SfMscrwHUWowh75KaumYmUDa3idDIU0uqXJsSKA8iYW47I6p/X4ZsDLPAEn/Qix DwYQ== X-Gm-Message-State: AOJu0YzsxTNIP2d+gdt9xgzkEKQCYL9bEnkMHmyRRtpAPUGk+rJ9wLOH jlTMq/3gallDIsdz5z/rNHcw92K5k/K0hqg0cGx98/SzrH0= X-Received: by 2002:a05:600c:a45:b0:40e:3511:2c39 with SMTP id c5-20020a05600c0a4500b0040e35112c39mr1353505wmq.172.1704469428691; Fri, 05 Jan 2024 07:43:48 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id k7-20020a5d6d47000000b0033725783839sm1599738wri.110.2024.01.05.07.43.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 07/71] target/alpha: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:00 +0100 Message-ID: <20240105154307.21385-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-alpha -cpu ? Available CPUs: ev4-alpha-cpu ev5-alpha-cpu ev56-alpha-cpu ev6-alpha-cpu ev67-alpha-cpu ev68-alpha-cpu pca56-alpha-cpu After it's applied: [gshan@gshan q]$ ./build/qemu-system-alpha -cpu ? Available CPUs: ev4 ev5 ev56 ev6 ev67 ev68 pca56 Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-8-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/alpha/cpu.h | 3 --- target/alpha/cpu.c | 17 ----------------- 2 files changed, 20 deletions(-) diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h index d672e911dd..ce806587ca 100644 --- a/target/alpha/cpu.h +++ b/target/alpha/cpu.h @@ -292,8 +292,6 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags); int alpha_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); -#define cpu_list alpha_cpu_list - #include "exec/cpu-all.h" enum { @@ -441,7 +439,6 @@ void alpha_translate_init(void); #define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU -void alpha_cpu_list(void); G_NORETURN void dynamic_excp(CPUAlphaState *, uintptr_t, int, int); G_NORETURN void arith_excp(CPUAlphaState *, uintptr_t, int, uint64_t); diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 83345c5c7d..b8ed29e343 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -87,23 +87,6 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error **errp) acc->parent_realize(dev, errp); } -static void alpha_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - - qemu_printf(" %s\n", object_class_get_name(oc)); -} - -void alpha_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list_sorted(TYPE_ALPHA_CPU, false); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, alpha_cpu_list_entry, NULL); - g_slist_free(list); -} - /* Models */ typedef struct AlphaCPUAlias { const char *alias; From patchwork Fri Jan 5 15:42:01 2024 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: 760174 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105526wru; Fri, 5 Jan 2024 07:48:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IERfvArcVkno1tdQCsjaMDVUln2JJfoMBcKApVfyCaqodWIjLHOGR40QCup6FYZ869rBNrG X-Received: by 2002:a05:6214:20c5:b0:680:c83a:346 with SMTP id 5-20020a05621420c500b00680c83a0346mr2841843qve.126.1704469730388; Fri, 05 Jan 2024 07:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469730; cv=none; d=google.com; s=arc-20160816; b=Nhz2sNLR5iEOQLGRF5D8R03mG8Y/wRkhV0Hp/IITgfpc3Dzm3/ABCTuTOKIcIec5Ft A6I75okhSv4OMbtb2R94adGqRxSTZUp6HW71jZP3ykf9ppO8R0jtPQyLGFiSRcXhNH2k 0F8Pql0tZQJq811WPVn7U8KFHsU+4/H8Tnkc19w8nE6vGaZ4wWuiLYEjUWT1m0vfZ/ii cJr4eGQSnI+6EWQRilLsricppzpCngJbvfHa8SoVq8uryGixEPAtR6ntemsE+NJDWZUC xUcH/Kv0RRCla60VLhWQfKxZvy3NafVtMZKk677gwcavku7asIZsHHKiD4ZXLrAsCq54 ac1A== 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=woqU0CJbLpbBNTO5d7sFgz50JLFq3nMIZ0ht3SRJ1YE=; fh=DAPvSgCUhAarA6fZ2xgq43lJ/6n+8M24aoksosCsGI8=; b=eOT99pFz8kudhZXAQjAIL641GIcCaToMJi7jdt+nanAaTYd/ijjrRoHp/aNl3IyXpW 90E7PJTwMYMjus/2qzIsyfogSzqd5cu8IEfXzadIs7oqBbetBZYNk9lfiB/Y2HTHBmSz FWkMV61BcO8B2wr8nnLkthEDAajHZMqcW6J0pcVEH+rMuPPnA1IAoS+X+T7bdCsT1DYJ OiFo/YLG3hKlxzCzEgI9a/5DspM5e4IKA+vY1KrZCEE1BtDsVovdzSpxRLDRnLwpQ/b7 0uojt3b8z1NRZbTWv5/t5cwjQzEa1ldo3HJRT/i3E1hENPp+edLaxzU3CLnx9I3xsJ9r tVKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xSpH4fYk; 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 c13-20020a0cf2cd000000b0067f8d8402dcsi1971071qvm.174.2024.01.05.07.48.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:48:50 -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=xSpH4fYk; 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 1rLmMl-0004pv-Cg; Fri, 05 Jan 2024 10:44:12 -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 1rLmMY-0004ga-Gu for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:58 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmMV-0003Bn-NC for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:43:58 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40d41555f9dso16539035e9.2 for ; Fri, 05 Jan 2024 07:43:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469434; x=1705074234; darn=nongnu.org; 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=woqU0CJbLpbBNTO5d7sFgz50JLFq3nMIZ0ht3SRJ1YE=; b=xSpH4fYkHdsPRicQUBBr9yk+JuKO+SmbCrl1mHawHDzs73/ZTgDaMs9ug/h5bG6sC/ jMvOYRWaF5Kjz0YAtG94CQS0/wLiZx0jMnWALgBH1yMluVYF12j2RuLShZKfWl5bHce1 lX2wuo+HsFcrOwjVp3RbwJWT03fXukqPB6dKVmCy2FdQ5GoVpJGn0IPWlQJWu0s4uH9M rZTbNjmh4nA0zZBjG5LfP5M/nIKGJEjKJQn1vdGl9Va170gWDXkqZ1BclqLdf67nOC8c sOn4x/gXWdO1iSn/TW5V9AEDvH6I5kE6gKMJr2h4MKfT61DbzM23GbNvjrGL2TT5MTmH gcFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469434; x=1705074234; 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=woqU0CJbLpbBNTO5d7sFgz50JLFq3nMIZ0ht3SRJ1YE=; b=m7N1Z7Dr31ou/K0zOErA7Gd2FTc/TTACr7wGvS9NGXQAticFsk/xxBGMSAobTGX5L+ bR6lcIBgncFf84xooM+DdQtH5p8S+3cl24kFXamUPNVWZmiAgD+lfYoHiEE2G36V3KG4 w2F8opUCf8F+rdtVcuf7lWWRaHdu24eUi8BKie2x3VV8+4qJjcdbBGf5CKoK14HcBE0k WHTUPRJZsJntvhLdvhGS9Nx5rj1dqy16Uy/hYSOjBXbFIoX7TtVUrWMoaAYJiFJuyx1a YoOnKHpvffsrDtxp0YIVEMjFyahz/uNyxLt/5DtirYyRpKu3yxTrHQ1tWbBrt4DLFpvd kX+Q== X-Gm-Message-State: AOJu0Yxj/uH1WPLHBRir1dBchQxvYHKudmOhEB4vblOoVIJ51R7mIoHr dWeL9WwttjB3R06LcHSqSjcqQfEsFJotzRy7eFHbrl0kW08= X-Received: by 2002:a7b:cbd9:0:b0:40d:62f6:5d51 with SMTP id n25-20020a7bcbd9000000b0040d62f65d51mr1336159wmi.127.1704469434059; Fri, 05 Jan 2024 07:43:54 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id z6-20020a05600c0a0600b0040e3ac9f4c8sm898004wmp.28.2024.01.05.07.43.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell Subject: [PULL 08/71] target/arm: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:01 +0100 Message-ID: <20240105154307.21385-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan No changes of the output from the following command before and after it's applied. [gshan@gshan q]$ ./build/qemu-system-aarch64 -cpu ? Available CPUs: a64fx arm1026 arm1136 arm1136-r2 arm1176 arm11mpcore arm926 arm946 cortex-a15 cortex-a35 cortex-a53 cortex-a55 cortex-a57 cortex-a7 cortex-a710 cortex-a72 cortex-a76 cortex-a8 cortex-a9 cortex-m0 cortex-m3 cortex-m33 cortex-m4 cortex-m55 cortex-m7 cortex-r5 cortex-r52 cortex-r5f max neoverse-n1 neoverse-n2 neoverse-v1 pxa250 pxa255 pxa260 pxa261 pxa262 pxa270-a0 pxa270-a1 pxa270 pxa270-b0 pxa270-b1 pxa270-c0 pxa270-c5 sa1100 sa1110 ti925t Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-9-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/arm/cpu.h | 3 --- target/arm/helper.c | 46 --------------------------------------------- 2 files changed, 49 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index a0282e0d28..8c3ca2e231 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2737,7 +2737,6 @@ static inline bool access_secure_reg(CPUARMState *env) (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \ (_val)) -void arm_cpu_list(void); uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx, uint32_t cur_el, bool secure); @@ -2840,8 +2839,6 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync); #define TYPE_ARM_HOST_CPU "host-" TYPE_ARM_CPU -#define cpu_list arm_cpu_list - /* ARM has the following "translation regimes" (as the ARM ARM calls them): * * If EL3 is 64-bit: diff --git a/target/arm/helper.c b/target/arm/helper.c index fc546df5c7..a2a7f6c29f 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -9468,52 +9468,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) #endif } -/* Sort alphabetically by type name, except for "any". */ -static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a = (ObjectClass *)a; - ObjectClass *class_b = (ObjectClass *)b; - const char *name_a, *name_b; - - name_a = object_class_get_name(class_a); - name_b = object_class_get_name(class_b); - if (strcmp(name_a, "any-" TYPE_ARM_CPU) == 0) { - return 1; - } else if (strcmp(name_b, "any-" TYPE_ARM_CPU) == 0) { - return -1; - } else { - return strcmp(name_a, name_b); - } -} - -static void arm_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - CPUClass *cc = CPU_CLASS(oc); - const char *typename; - char *name; - - typename = object_class_get_name(oc); - name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU)); - if (cc->deprecation_note) { - qemu_printf(" %s (deprecated)\n", name); - } else { - qemu_printf(" %s\n", name); - } - g_free(name); -} - -void arm_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list(TYPE_ARM_CPU, false); - list = g_slist_sort(list, arm_cpu_list_compare); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, arm_cpu_list_entry, NULL); - g_slist_free(list); -} - /* * Private utility function for define_one_arm_cp_reg_with_opaque(): * add a single reginfo struct to the hash table. From patchwork Fri Jan 5 15:42:02 2024 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: 760166 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp104985wru; Fri, 5 Jan 2024 07:47:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiXBOJjMNS9Ls5Z7GLx6dKZ5oCkyNrcmH1boNWgSdV7+xLhF0hpSUo4UczRhEoQvEbgJsJ X-Received: by 2002:a05:6214:268b:b0:67f:c054:14f6 with SMTP id gm11-20020a056214268b00b0067fc05414f6mr2765185qvb.126.1704469657400; Fri, 05 Jan 2024 07:47:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469657; cv=none; d=google.com; s=arc-20160816; b=SVgdVDAJimzdKWW8yTzOww+uh/tm5shGx3cJEKxZzih66ujq0blJMw2bahKwd9GrFd 0XgUcF/xwnxuY1Ryfdn2NlJfaHIAKpjF8up+BrkspbaClwEYVtwYUjkf0FZ5PFwgIDY2 Bip/4kOpZyUMO575cQdi/bB1LSMQ9y3u6tv7t68EJBOf3v4dQNDrgbFjSfV2MzcMUui6 Z1kdkCk4QGyz5ZRU8OO56dUuDuCA8EFeNt5YnjFKJ9Yj4avQmxyTT0j3wzQs0ZMEg6h/ lype0cmGxRdicQjl4GSxP4rKwEgpM7Vp0xqFcpi4gStILaBez4CMqfRVINT52Q7mWSeu RAUA== 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=wJixAs+R9evY25N/DNdQZkg5UuMmYpP4W3heU6glhRE=; fh=koaf0Gu+9SYZKrYDVjZfGS7VP9KAgrf49CflV3EB0FE=; b=PQfqhRlyZ2CYUENfQuRDaLCHu2WlhKLaMfZ3bTHDmemwO+yS+FM5KkHtXaBtYX9BVI QHor+NyVSNiNr6mye7U3Ejy1w3gSQI8tgRyjrHwe/oih8t80JfXiYzNQ0biuIo+vv7zk ZaU0uTwfg//XbFszCUx2EBkES8cuh3VEOVhiJe+mRGlbr1kL2ubpeDJzX7OeQWYwnk/2 jAHiUHNeUptDbbL08E+jzeGMORmvNzUuW3fKQ/jTNb3UE7sF559uD/CYppHZM52s9eOk 5wFFd0PkLludHPoW5gmcHbJ41RID4Am+eqgbYdeuO1rA+yMkh7YiVHfp5wWV8c7URyxp 8UGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dXDd3JGI; 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 a11-20020a0ca98b000000b006804ee661b3si1985723qvb.125.2024.01.05.07.47.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47: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=dXDd3JGI; 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 1rLmMo-0005DM-2V; Fri, 05 Jan 2024 10:44: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 1rLmMh-0004rg-7i for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:09 -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 1rLmMa-0003Cq-Un for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:06 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40d4a7f0c4dso17351955e9.1 for ; Fri, 05 Jan 2024 07:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469439; x=1705074239; darn=nongnu.org; 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=wJixAs+R9evY25N/DNdQZkg5UuMmYpP4W3heU6glhRE=; b=dXDd3JGIuaPHal0zUrDxlITmM54qS28iLzvT+rq/Gkdm52HjQzg0GEOVMF9jClL9sV eDFlkkG6cUlEIoojkUW2po6dEB4zi5vkfgdMqE1zNAfZ8IPEGvIr+FqDArz/n7YKTmaT pX9qcPhG/F+DmmejqoCM8uVfAAGJoeFaZfNCR7lXiVE1NZIWSiRAK6YQ6f241GbAtg+Z r8gCue8Kl/YsHkLZ8lnr0UGvzc2xQ8MZqw5qz4LsGD/PCGyATYNCI9yhWThtdEJ5sqfZ NjtHaygNVrWm6Qd3fTZnFUFL6Z5nvT7OGIZtCCOeuRLa8gJQxJj2Q5o1eKNEtf7tV6Ts lgdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469439; x=1705074239; 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=wJixAs+R9evY25N/DNdQZkg5UuMmYpP4W3heU6glhRE=; b=H5ZzPywx2Rhdi0dBuq9Fc9vNbcT2wvnbYhWZsRISO7weOZXB9Pzq+HPC5q3mVG4A2i f0I4wQonvcom8aCFZisPGJPkSI/ZeAfR4mmbJzHZRhwsP7o6Hmw0RB5pPIfiLEJ7hzJ8 xfRrFn/DMVjhew226//YibTSTWN8i7JR/trq+USk1muoaT+BAFT7Ca/hLaWkW45QE6we y1mmT2Z13qd+Mshvp9sVztdcEUgljVxiWKZmAf07UYMS4Lc16YVxb3+1MfLk6iVOb5iH p5NoKlcetVaRNYDja3to7vnvn+Ft2vEKnTkdQ2JWq5hlByNqAD9kJias6tayU0TUWoxr iGTA== X-Gm-Message-State: AOJu0Yx/HdB97sGAXI8Tt2XSe2tc/McZUzRxnagG3UtpMzq5wmt6onyd +qO5CBa3o63lul8ZGWrphfFCwa03Mm93XM6R1yuSqPSJJc8= X-Received: by 2002:a05:600c:13d6:b0:40d:9336:2991 with SMTP id e22-20020a05600c13d600b0040d93362991mr1231609wmg.129.1704469439492; Fri, 05 Jan 2024 07:43:59 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id n12-20020a05600c3b8c00b0040d62f89381sm1929866wms.35.2024.01.05.07.43.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:43:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Michael Rolnik Subject: [PULL 09/71] target/avr: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:02 +0100 Message-ID: <20240105154307.21385-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-avr -cpu ? avr5-avr-cpu avr51-avr-cpu avr6-avr-cpu After it's applied: [gshan@gshan q]$ ./build/qemu-system-avr -cpu ? Available CPUs: avr5 avr51 avr6 Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-10-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/avr/cpu.h | 2 -- target/avr/cpu.c | 15 --------------- 2 files changed, 17 deletions(-) diff --git a/target/avr/cpu.h b/target/avr/cpu.h index 7960c5c57a..7d5dd42575 100644 --- a/target/avr/cpu.h +++ b/target/avr/cpu.h @@ -184,7 +184,6 @@ static inline void set_avr_feature(CPUAVRState *env, int feature) env->features |= (1U << feature); } -#define cpu_list avr_cpu_list #define cpu_mmu_index avr_cpu_mmu_index static inline int avr_cpu_mmu_index(CPUAVRState *env, bool ifetch) @@ -194,7 +193,6 @@ static inline int avr_cpu_mmu_index(CPUAVRState *env, bool ifetch) void avr_cpu_tcg_init(void); -void avr_cpu_list(void); int cpu_avr_exec(CPUState *cpu); enum { diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 3e478294a6..f5cbdc4a8c 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -362,21 +362,6 @@ typedef struct AVRCPUInfo { } AVRCPUInfo; -static void avr_cpu_list_entry(gpointer data, gpointer user_data) -{ - const char *typename = object_class_get_name(OBJECT_CLASS(data)); - - qemu_printf("%s\n", typename); -} - -void avr_cpu_list(void) -{ - GSList *list; - list = object_class_get_list_sorted(TYPE_AVR_CPU, false); - g_slist_foreach(list, avr_cpu_list_entry, NULL); - g_slist_free(list); -} - #define DEFINE_AVR_CPU_TYPE(model, initfn) \ { \ .parent = TYPE_AVR_CPU, \ From patchwork Fri Jan 5 15:42:03 2024 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: 760201 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107644wru; Fri, 5 Jan 2024 07:53:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IH63WgwLf6TMHU6gchgfAR68dGpA++TGVwAXt8YqexBs8qzsjP162uHviX8WZSQ5Q/uysK8 X-Received: by 2002:a05:622a:1105:b0:428:3d8d:38a8 with SMTP id e5-20020a05622a110500b004283d8d38a8mr2440493qty.69.1704470018380; Fri, 05 Jan 2024 07:53:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470018; cv=none; d=google.com; s=arc-20160816; b=RFToWJsM4N4RLhMSGcICAFPhblE/opkuuGGgka8sBE61ymEwxVgvwQTY2FaNqJiJ6D 3PSyOX03hKtpMeaAdNJPKmV+6bZ5rG/GLxe2FuWZbIPWvnroYUykfACZ7LeGrkASnpP8 CRU5iM4LFppAdP9RptULNvSc868vcIqbd5/rOH1qNvfbdOiFlJX7HsMU8lQnRL8cMcSJ /o6SgRv5oB7vzYC/t1/aEiNVuLWMIr5uWlRF0hnqhanDPOGzPOC7QhYxqh7Oqwk9ve7Z UxDXLE2/ePhxMQBg/DHtmQ3pV5OtiV+bBbjxsCmjKXtqD8G40PfEAXfSF1eZ+kh7L+E6 8XdA== 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=T2dHbEy97kiYKLMLDn2+e8bN6W1pBXRM0uBjrESXiSY=; fh=tROm31tyoJcOlKLqF+Vl530andyBxyZ444yuWCVrtms=; b=r7EIHAxmQSsw5mbpmKKCLPyJRWx/pmo/Fzu1dshcEdMBmlYILraaPYpIJwUbPRNoYD gfizMKj9EIaZaojWXcGyWE9nBuDvGPMLycLM9yJfxrt/UkwHuB876d7rMZp+nGkpszwW q8YDieywvGj65F70bKE7Ujcho0OsW8O0uadhkB3tEgzi8x7MYrG7mXZYsYM5qvNRZ6Mp NHGCi2i7EUHxEIT3hhT5T8621MLFpid3E3JUYk6F8xGDu0jlYhsDjpoPQPLx6hzj2pd4 5ilXQaj5ZT4/Y7iUOLBbssR8SGVvgS38MbEoK/3/M44xKSg0ixr134v6iV1qPOUUwoPv 5sDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZBOGvIPL; 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 h6-20020ac85846000000b004297deac925si195284qth.654.2024.01.05.07.53.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53:38 -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=ZBOGvIPL; 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 1rLmMn-0005Ca-NV; Fri, 05 Jan 2024 10:44:13 -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 1rLmMj-0004vc-Vm for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:11 -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 1rLmMg-0003Dj-UV for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:09 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40d41555f9dso16541075e9.2 for ; Fri, 05 Jan 2024 07:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469444; x=1705074244; darn=nongnu.org; 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=T2dHbEy97kiYKLMLDn2+e8bN6W1pBXRM0uBjrESXiSY=; b=ZBOGvIPLJTGuTvxZxFQsst4Jj8nIUCkX9RExawr2nM3HtE3xZ54Y1YeQGhRQeHMkTt tgk/zCqcNTK29KZEEOo0VRvQdFC/x8bhdxPiMB3Z1MFrW+UmV3B7FZhYUbn5Ru0Dbz82 dQDXwU7LfDVDdAgD33tZDhmUrrUJTVjA8tgHPQmenjGJ4jeomIi6+NX4Y2OQVks5OjCS LWfLbAkhtElDHngHLq3+HHiNtY805W1LCfGzuCOrO4vNHKvlhQVRwEb5oYdDdWaSzBpT kX0zd5qcjw6SD+/sVNoWURxBTQTqcU8z6Vr+q9n53AOG2Fy5KZhZbAwYhaog2pp5GJrd iB4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469444; x=1705074244; 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=T2dHbEy97kiYKLMLDn2+e8bN6W1pBXRM0uBjrESXiSY=; b=J0JoCWcnKJkqOlFRoguZUGjwj/2Nz7ssk6YMAISm+QIr8nXu32wn8PeylanmhTuC9r Qi2cu/A4VD+Ua62340EhKiXRInzP1wUQ+cY2FiVsrB/J2m6WOWt899zHNKbxTa3aXOtC WmwESIpVCrQexcCrBIYwpzv5FPUFB5f8VFJviMgSvupGXhpwNspZfxLHZszxv0Y516Dq Ic+PJrHWvNtO55h+7FujvIi3tBlwEny+pI0/cCEYG1dO/Lzx5kAoyEltb40HQ5nSylRT /1DFksTIq3fiIb63OKsCVk+wNdiRwFVtxi3WLoOdkBMxUaq6pAE21dQ9mcOlk2bD9V9a nhVQ== X-Gm-Message-State: AOJu0Ywwc4SiQ2Nbk1kV9zNj3rTKZXGs1G/0Voa6KinryXr2Ck8dchU2 dRpR9Gbij61VzOgRL7S2qUM27uJJpxAgalZz4Lo81OaDIo0= X-Received: by 2002:a05:600c:8515:b0:40d:5a9f:2b59 with SMTP id gw21-20020a05600c851500b0040d5a9f2b59mr1265328wmb.41.1704469444712; Fri, 05 Jan 2024 07:44:04 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c4e8d00b0040d887fda00sm1904820wmq.26.2024.01.05.07.44.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , "Edgar E. Iglesias" Subject: [PULL 10/71] target/cris: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:03 +0100 Message-ID: <20240105154307.21385-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-cris -cpu ? Available CPUs: crisv8 crisv9 crisv10 crisv11 crisv17 crisv32 After it's applied: [gshan@gshan q]$ ./build/qemu-system-cris -cpu ? Available CPUs: crisv10 crisv11 crisv17 crisv32 crisv8 crisv9 Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-11-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/cris/cpu.h | 3 --- target/cris/cpu.c | 38 -------------------------------------- 2 files changed, 41 deletions(-) diff --git a/target/cris/cpu.h b/target/cris/cpu.h index 1be7f90319..d830dcac5b 100644 --- a/target/cris/cpu.h +++ b/target/cris/cpu.h @@ -287,7 +287,4 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, vaddr *pc, | X_FLAG | PFIX_FLAG)); } -#define cpu_list cris_cpu_list -void cris_cpu_list(void); - #endif diff --git a/target/cris/cpu.c b/target/cris/cpu.c index a5083a0077..9ba08e8b0c 100644 --- a/target/cris/cpu.c +++ b/target/cris/cpu.c @@ -99,44 +99,6 @@ static ObjectClass *cris_cpu_class_by_name(const char *cpu_model) return oc; } -/* Sort alphabetically by VR. */ -static gint cris_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - CRISCPUClass *ccc_a = CRIS_CPU_CLASS(a); - CRISCPUClass *ccc_b = CRIS_CPU_CLASS(b); - - /* */ - if (ccc_a->vr > ccc_b->vr) { - return 1; - } else if (ccc_a->vr < ccc_b->vr) { - return -1; - } else { - return 0; - } -} - -static void cris_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - const char *typename = object_class_get_name(oc); - char *name; - - name = g_strndup(typename, strlen(typename) - strlen(CRIS_CPU_TYPE_SUFFIX)); - qemu_printf(" %s\n", name); - g_free(name); -} - -void cris_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list(TYPE_CRIS_CPU, false); - list = g_slist_sort(list, cris_cpu_list_compare); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, cris_cpu_list_entry, NULL); - g_slist_free(list); -} - static void cris_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); From patchwork Fri Jan 5 15:42:04 2024 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: 760190 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107163wru; Fri, 5 Jan 2024 07:52:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVWITa8oqJokFeOv2c8x4q51RcRSn4Ztqt6HUiu+n42DYc4TSq14291w0XkTbr0bnThLn/ X-Received: by 2002:a9d:64d9:0:b0:6dc:80b5:6275 with SMTP id n25-20020a9d64d9000000b006dc80b56275mr2027457otl.65.1704469959792; Fri, 05 Jan 2024 07:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469959; cv=none; d=google.com; s=arc-20160816; b=WEzjdoOPD7czcQB4Yko6XC/jYf5zNywcSUwyXZvMQrb+C43fuosy1CdAPskaPm+Jeh 8jVlju6YV0gIdvaYpP+L1n4bK54e7HilyiRUVg6e7DLMkBQXus9yRZihY8ZHRCypWoc8 G3NoJST4JSjtIhAZNT7RbwanB3VOoZWTHXzEo6Prtu/U935RB3xys0wvgszlb4sVCP/K mxSiMi0yCbvYvf3Um/stPjqDVRQk306a69flAdLsMfa8l8FX835URbcugInNuvyJiHRY kWBQ5tnfMZ2OaqqrSP7AuoFGjtZ7VdyBn2C96WulCgaXtqgb9qykdcn5jEKSAJXZU/8w D8ag== 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=MTyqf1UOhmXWKWjB2kbjbecKyF9tbZD+k3iPAVC8zqk=; fh=ZfmZ91dT2fDtwL0voXDf5Nuiara66u54o8Fu7OweU7M=; b=BmWRaomluzULUsoJGVQoM6hVmEpdD0HYEq47JHyH6d6y4uZ27bMWOf6rSgkuRcq03d GOPO4mCmtH2mQ9WB79sM15U202g6RurnVlkQOya9Hs/vsGdl6xegQpS4xaoVxiiF576Q GWrBc9dK2WbDQOekxy24ofT4ON5fx6aEOMaeUhE1A73D6vblwamGV8l097hUUe5Btxwd XE8JIcPki6pTLAA27dC1XTL6hYbIV1Q7HnVAjZ1atJ/8TBpw5Ze6XeGUu7PaADXLYwcK iyQCPDtC95lNROJ2k98I8dVvUbudXqNFA/6E3SjmesmVZkaOpGexb1ljynI7v59shZFa 44jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HHmzfCby; 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 13-20020ac8594d000000b004297e904304si4518qtz.35.2024.01.05.07.52.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52:39 -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=HHmzfCby; 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 1rLmMr-0005Q5-43; Fri, 05 Jan 2024 10:44:17 -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 1rLmMp-0005G9-8W for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:15 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmMm-0003F6-5o for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:14 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40d60c49ee7so17368705e9.0 for ; Fri, 05 Jan 2024 07:44:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469450; x=1705074250; darn=nongnu.org; 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=MTyqf1UOhmXWKWjB2kbjbecKyF9tbZD+k3iPAVC8zqk=; b=HHmzfCbyDxgSNouK5PFaSTbIUfIyKA5KYDHdhQCM/v59CT/QVijLLoxM9MzIIlI8lk bzYTlobLBFs4KVVjenCvEkCw5I5Wy45FprpKkVv8wGc9PflKoqwb0nMU4etKQNytio+L pDHcbO3/fXusXREE50o/AH/HCe/n0Ict/ytBu2Y79mxe9HuDmruDJ9OKViQfxCFoaESR 0r7nsi8wFWRf5zhZMs2TuhZGNijGgN7zjRbdEroqN9KabFo57RNTrmXvdHp3gj9TWXKK eWa4SLmc/aJV2Gupw+FYDx0sP14G0nJUBlc+DCE2K3wFg6kM9Upv84+hA3lzkq8TjO8O Azkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469450; x=1705074250; 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=MTyqf1UOhmXWKWjB2kbjbecKyF9tbZD+k3iPAVC8zqk=; b=F8V+YWM7ebVHu0/zG9GMpXeuQibFz1TJxpniONSOa2HkgenoWlP7Ckc79EOJ72S7Dk G7zFpS+sfZNNvGt8bNbEf14aFlryWACsDAtmr23NskeZcLXSecmNK1WV1C00HYF7DLTD F607kf8Zn4CJ44WwiFRly8Xey7+T0Oe0fkkgokwxkm72CXl0AlbUQLpW3BgqkyR4ejF9 3TdaV5+Atyr1uwHp6qm21M7zxtFk3G3UpX3rtU7+ZTKOK5btftbyvIc1wA8BByx9rSs5 4LaREvUc6PP6niGaOsfSonx1E6fQSEqkgaiKKU3kHdFTrwy5iIatkw5S+dUMuD8vnbqw gByg== X-Gm-Message-State: AOJu0Yz5ESHqHZdF4h2cFbQQbdZ6pndC7+v3buXrO3U8xRqsxU9y50dV c0WvV2CrB7ZCFykhDxKZlagiPgrto2MHmcpslmwoxUh5FAU= X-Received: by 2002:a05:600c:5487:b0:40d:6e2f:da7b with SMTP id iv7-20020a05600c548700b0040d6e2fda7bmr1311698wmb.13.1704469450494; Fri, 05 Jan 2024 07:44:10 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id d3-20020a05600c34c300b0040c3953cda5sm1950432wmq.45.2024.01.05.07.44.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Brian Cain Subject: [PULL 11/71] target/hexagon: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:04 +0100 Message-ID: <20240105154307.21385-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan No changes in the output from the following command. [gshan@gshan q]$ ./build/qemu-hexagon -cpu ? Available CPUs: v67 v68 v69 v71 v73 Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-12-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/hexagon/cpu.h | 3 --- target/hexagon/cpu.c | 20 -------------------- 2 files changed, 23 deletions(-) diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 7d16083c6a..5c11ae3445 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -37,9 +37,6 @@ #define CPU_RESOLVING_TYPE TYPE_HEXAGON_CPU -void hexagon_cpu_list(void); -#define cpu_list hexagon_cpu_list - #define MMU_USER_IDX 0 typedef struct { diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index aa48f5fe89..c0cd739e15 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -32,26 +32,6 @@ static void hexagon_v69_cpu_init(Object *obj) { } static void hexagon_v71_cpu_init(Object *obj) { } static void hexagon_v73_cpu_init(Object *obj) { } -static void hexagon_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - char *name = g_strdup(object_class_get_name(oc)); - if (g_str_has_suffix(name, HEXAGON_CPU_TYPE_SUFFIX)) { - name[strlen(name) - strlen(HEXAGON_CPU_TYPE_SUFFIX)] = '\0'; - } - qemu_printf(" %s\n", name); - g_free(name); -} - -void hexagon_cpu_list(void) -{ - GSList *list; - list = object_class_get_list_sorted(TYPE_HEXAGON_CPU, false); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, hexagon_cpu_list_entry, NULL); - g_slist_free(list); -} - static ObjectClass *hexagon_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; From patchwork Fri Jan 5 15:42:05 2024 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: 760184 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106232wru; Fri, 5 Jan 2024 07:50:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkUJxP6qqRDvUsX0Nx0Lg/iA5pv5OBhGTXmKmrysrHWt6nTtw0HDYA6fOFhVIpZt1yRcla X-Received: by 2002:ac8:5a46:0:b0:429:71a0:5900 with SMTP id o6-20020ac85a46000000b0042971a05900mr2743832qta.19.1704469822540; Fri, 05 Jan 2024 07:50:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469822; cv=none; d=google.com; s=arc-20160816; b=iSl4XIvZ4OMR0fWVC3yhQITKkwrg1mFlmLhx1dtD3zCMmZCzh1QTAhk2KXgzjjyCvd C8didyXEvLsB8LRdXpNfVoy9l98064ki53Dq+Mldrb4Fqadrd0RgRCyrBQEsL4PXyhTi yFBAgx9HJ1bId94hQ5AouJxJl9Vg5QVP4LIL0fU8bTl62CNxnN/6SePzt3NdFUHzba0C EC9WZlRnDd3dqxpcST/yuokOZVCbrj84oQCHLSG8kknq4JW42Pr6/7lsXIgRPsaEP0Mb mAX2ZxIdzzGbRHA6kfkJv79ITxN0Xouf3oGGjgXa6Rhbn9Vpi5PexlRKOW4P/Q8CnBuB AVig== 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=eJb6ytKuwy0SF9EvoPkrRPYTidmv1mDxbmTN6G8AydI=; fh=E3k/bJOAyn8KVkDcw46+fm61XnY03SPmE0lR/AkVOTI=; b=CMIq9i1IsYhGAsDMAoIIHp65dyS8B7IHyb4ltRT2U576fqWDUYtGLwVFo+TGHmnAyF rXPLZ3u50PW0joF6IIE0x28SD1X47E7YtUa1dSlR51MwbkoMz0qAaTYrERtUkauTJuPQ ULS0Z7pHrlN7l2seqWucwC7a5RDuOOJCp3lm+9W9Tcijr/wrZdPqUqwbqBRZoA6w+jiC sUyD1XwlxXJ8n5xTGpJjli9vOec/R/Apb5D7B9nWIEnh7vBBg1CD7sT7PbNHQCBXsOGQ n+b2jOD4PgFjWSoygLwdt3R00PcWAwziagLhTqBfkz1VFPjdajidnMEwuAOs9roGRspf ojqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cfSamfYJ; 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 x2-20020a05622a000200b00423b62153f5si2103189qtw.341.2024.01.05.07.50.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:50:22 -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=cfSamfYJ; 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 1rLmN1-0005ou-Tu; Fri, 05 Jan 2024 10:44:27 -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 1rLmN0-0005k7-6P for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:26 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmMw-0003IG-LX for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:25 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40d5b89e2bfso16264625e9.0 for ; Fri, 05 Jan 2024 07:44:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469461; x=1705074261; darn=nongnu.org; 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=eJb6ytKuwy0SF9EvoPkrRPYTidmv1mDxbmTN6G8AydI=; b=cfSamfYJHvttQZI8Hlw7NrxUWt7IHcgswNdOC/7jRPSGjPJHXM1phYlj9ij4zeBhbY Cya5Vxqm9tOIKMuuQxXhllcdJ7fzv9wPQyab0cL0ToP63txI8j1McsX3uSDkobRUmi+M iqGXG3/WJwfa9d/J4w9pXLFuqaz2OKeBUp3bRHlq2Zc3kjfz5kyEHDZyWXOeAdPaOl0o yCMjFSoy+s4iboDDITIqpKbW53XQuhMNijTUSUTE0bZPbPRv8yc90prpbWYGU7otXYws 9n/huM3w2FpolaNrWj6MayhMopyZhsxHCh9btHLmZQAKa29BWrFwS9DdWYKZUKE7aPtL N7ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469461; x=1705074261; 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=eJb6ytKuwy0SF9EvoPkrRPYTidmv1mDxbmTN6G8AydI=; b=ijxEVL+EazjW7E0xFb3m0BMRi4SO+NG2xWeWU+LCEGtKcRA4qFxYf7EDWlFNWL4P5H 5qNF/9rc23eUrMRH5QKZf87aF9hBShqo41AFgqE+GT77+ZO9I3Kb9ntUmjWdtJSSOWH3 myvwYm6ceay8epUu+HqUyLDzcoZiJrQBkxvNA2gMsZF8CRZafLCmMROetThZvf1KBQQf Aq+19zJfqM6ONVV1UTFFitC8K8HIT9+a3742H7mWPDGt/VLs8YVZG6XNiKPeCHlUL0R1 tgDkIusLbmyulFN8GjU4aLSM5TX66fuTeVHfQJ24OIrhL0q45vVMvWBtuaK5m+ZSoLsw cxBw== X-Gm-Message-State: AOJu0YxLpatEp35OAXmntXJm63Dza9iR9GqHrSboZwXcTapCuC7Y3dm/ AyKbOxyxuNZGw8T7mDXP0xZuV93PCU0em9src+MVrQbnd0c= X-Received: by 2002:a05:600c:a001:b0:40d:5e0e:8648 with SMTP id jg1-20020a05600ca00100b0040d5e0e8648mr1228913wmb.159.1704469460842; Fri, 05 Jan 2024 07:44:20 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id l3-20020a5d4bc3000000b00336843ae919sm1609483wrt.49.2024.01.05.07.44.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:20 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 12/71] target/hppa: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:05 +0100 Message-ID: <20240105154307.21385-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan No changes in the output from the following command. [gshan@gshan q]$ ./build/qemu-system-hppa -cpu ? Available CPUs: hppa hppa64 Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-13-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/hppa/cpu.h | 3 --- target/hppa/cpu.c | 24 ------------------------ 2 files changed, 27 deletions(-) diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 8be45c69c9..fd659ca88b 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -402,7 +402,4 @@ G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra); #define CPU_RESOLVING_TYPE TYPE_HPPA_CPU -#define cpu_list hppa_cpu_list -void hppa_cpu_list(void); - #endif /* HPPA_CPU_H */ diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 1a5fb6c65b..e1f252cc45 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -164,30 +164,6 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model) return object_class_by_name(typename); } -static void hppa_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - CPUClass *cc = CPU_CLASS(oc); - const char *tname = object_class_get_name(oc); - g_autofree char *name = g_strndup(tname, strchr(tname, '-') - tname); - - if (cc->deprecation_note) { - qemu_printf(" %s (deprecated)\n", name); - } else { - qemu_printf(" %s\n", name); - } -} - -void hppa_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list_sorted(TYPE_HPPA_CPU, false); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, hppa_cpu_list_entry, NULL); - g_slist_free(list); -} - #ifndef CONFIG_USER_ONLY #include "hw/core/sysemu-cpu-ops.h" From patchwork Fri Jan 5 15:42:06 2024 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: 760161 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp103903wru; Fri, 5 Jan 2024 07:45:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHptNB/KMoP+rwX4+1yvpfka+dDDzDunCh4IFuTUFO6xfAPbiYRbwbK254bwXo6fr9Supwj X-Received: by 2002:a05:620a:4ad0:b0:781:706c:4e8b with SMTP id sq16-20020a05620a4ad000b00781706c4e8bmr2898007qkn.78.1704469519800; Fri, 05 Jan 2024 07:45:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469519; cv=none; d=google.com; s=arc-20160816; b=hvTM20OHCF+2rjgW6USCGdER9tS48zQ7j/C0Q36t0QPbJpS+evOKFBJcM4ZtZ77cx8 kW2hE8WbEtWZmRKn0CBYqgUYhCHfH25Jbqjt47HANA0ihPBpNN2E776QAg7fkp5AspH0 VpxruifNfpNKK/Zd4fWV9OdTWXix4gsTrciRvG+jNgEH6YVU1imctHhurHjASxmUe7OK Icln+blRx1DsLfR82808edClG7aRkOTxTCjBsW8Tmalcb3vA5wCDw4FEFKK9de7FSDU8 8fYp+GUWVt+H0vROYAtqqKuweecRRxs37dRtyQ22CRYgEJ11c0mQ0kTpYgGnOiIH6bJs hlfA== 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=3F01YLhzgjTdtmytUy5rbru1eD+VsYVlRXqJFlFh/Hg=; fh=6oFdbfvy2CilAP0eadDcmbW+cZmCcVYrHTIFJj2TpHw=; b=AU5/Q9IJ0tXV6XOwMD452qb++hymYSKBwt45u3pb4mnBTYid+lJsMZAOzbfi2bnxAq SJXoUgBmPbeHF7++4wPBs/NCMkzttySx4TKqSgmgaa7/BPPjGgeMuIiUgQ9Ofp4Qf+dC QMV06K9LwAqubA+3aUAA0hnOlsMvFtUDfSAyYBf3740jrZgC6yc4pqb5vvLrt72lFPBm MdTNiukAYSQ985ja9JEWXhXWINtHIuRuCXPjsfdin+EIqnRQxOVNw0XYCojMZBbj1JTQ GdbyR3gRcqfD1J4Ps5RoEgI/CKdP6t5i4eCUa6yt+kxLWWORlRzB/0ATcb+CLL7TcD11 Pmhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DTGr9hZh; 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 v14-20020a0ce1ce000000b0067a9b3d05b8si2042375qvl.110.2024.01.05.07.45.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:45:19 -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=DTGr9hZh; 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 1rLmN8-0006Ls-QX; Fri, 05 Jan 2024 10:44:34 -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 1rLmN7-0006Ca-8r for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:33 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmN3-0003JZ-Ds for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:33 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33686649b72so1469411f8f.3 for ; Fri, 05 Jan 2024 07:44:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469468; x=1705074268; darn=nongnu.org; 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=3F01YLhzgjTdtmytUy5rbru1eD+VsYVlRXqJFlFh/Hg=; b=DTGr9hZhGcXyItA9vjUOyMeef6a4deRm4PvKLmdkqvVLo5dIUmdsBNIeLo5GiLEvlA yhhnyjCuWApfTCU0EOFfPQegTY0Bp80Wd2xdRDjDCR/gmiWMMw9S4ujpGbmJG+aK7HYH hQ8xRgCXSRP+7yYh+ni8aNJm28sVXPXIHg2HJilj9y1LZbzQUJ06vXuMge1IPwX/4x61 xDHddJih7EkNZ7xb8Kd79m4dEfcZLGzbLIWvlsDjDYuRF72T9yDjwptWP7gl+wKlsFTC QMxEpwke8fUiNJ8q6uatKNyD8bashtpV58ZCf4IwBPiJX+uSrdAfriE3KWVs4nGBh7Vv wt/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469468; x=1705074268; 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=3F01YLhzgjTdtmytUy5rbru1eD+VsYVlRXqJFlFh/Hg=; b=sJeFHKHlcVP493XwEMGpCU6EZrHV3Mv0JXTWcnaQbXiVa7pfzLBNmTNI73Y5ux9sYQ ww9CfMcDklQKXhRvQ9zFt6mUE59A9hW++yvhQt3dG4ejjSnnusAz8ztVEePXgVkJoUUJ vunxsgthe8B5kIFhtawFC7ue+rpEKuN9+wua/kDJyUmmya+b6AaG9IX6sd/y5wmD0M0c PN7YD4z7VmDp96i4wcAIGNrQEJw+JW3L0m/g6B/QSti5BJ7Aigp2oXiuvhvBWQyWe/RK dPTTAawr0MCosRGOPLo45pfdDr+0bftFG8jTV1varcu3bOvPwlLvkq9FFwm1GNkg4Jvy s+2Q== X-Gm-Message-State: AOJu0Yx5vMx3OPY+WdlwiqPLzxaNZKURxDixCS2Vayv5nM+F0muVjIeL c2VIEBRiLO+j33rMwEunb4m0WvJ7qcYcsuEA/y2fnVA7XoE= X-Received: by 2002:a5d:638d:0:b0:336:95d2:c649 with SMTP id p13-20020a5d638d000000b0033695d2c649mr1282677wru.125.1704469467904; Fri, 05 Jan 2024 07:44:27 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id p17-20020a5d4e11000000b003365951cef9sm1605022wrt.55.2024.01.05.07.44.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Song Gao Subject: [PULL 13/71] target/loongarch: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:06 +0100 Message-ID: <20240105154307.21385-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-loongarch64 -cpu ? la132-loongarch-cpu la464-loongarch-cpu max-loongarch-cpu After it's applied: [gshan@gshan q]$ ./build/qemu-system-loongarch64 -cpu ? Available CPUs: la132 la464 max Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-14-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/loongarch/cpu.h | 4 ---- target/loongarch/cpu.c | 15 --------------- 2 files changed, 19 deletions(-) diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h index 00d1fba597..0c15a174e4 100644 --- a/target/loongarch/cpu.h +++ b/target/loongarch/cpu.h @@ -466,10 +466,6 @@ static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc, *flags |= is_va32(env) * HW_FLAGS_VA32; } -void loongarch_cpu_list(void); - -#define cpu_list loongarch_cpu_list - #include "exec/cpu-all.h" #define CPU_RESOLVING_TYPE TYPE_LOONGARCH_CPU diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index 81f2d8d8ed..87dfcdb0a5 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -483,21 +483,6 @@ static void loongarch_max_initfn(Object *obj) loongarch_la464_initfn(obj); } -static void loongarch_cpu_list_entry(gpointer data, gpointer user_data) -{ - const char *typename = object_class_get_name(OBJECT_CLASS(data)); - - qemu_printf("%s\n", typename); -} - -void loongarch_cpu_list(void) -{ - GSList *list; - list = object_class_get_list_sorted(TYPE_LOONGARCH_CPU, false); - g_slist_foreach(list, loongarch_cpu_list_entry, NULL); - g_slist_free(list); -} - static void loongarch_cpu_reset_hold(Object *obj) { CPUState *cs = CPU(obj); From patchwork Fri Jan 5 15:42:07 2024 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: 760205 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107925wru; Fri, 5 Jan 2024 07:54:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/3vx45r36GdiGLGB7JM7Eg5CTQ2rDYT5FP+smzT6jrR9Mh0mciCjh/7gW4PGAXmxmDtzM X-Received: by 2002:a05:6214:5007:b0:67f:47fd:79f6 with SMTP id jo7-20020a056214500700b0067f47fd79f6mr2761210qvb.95.1704470062760; Fri, 05 Jan 2024 07:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470062; cv=none; d=google.com; s=arc-20160816; b=ehFiLZQaR9Eh31tAlPBQs/MDLVdkxV4rY0bwbLTf42/yso4IWBWIA2pf0NHremjP/I 68GreaDuwgWoJRj2ivVz1ls/uhc/lCnSneF7I+A5L/ByGKDobvRud3u+q/TIHEA2aj5h cH/h+NhFFrv4dWdmsLnOxst2VfuqeEV+JX/vc+6S4yQH5R59HizaC8vatMY2yVSXxLfR F51dKAt1A2IP/+v2HiVzmKfspKrS/fq00kpaVu233swa130fkTPMGDcXHebcF3kXLkwy uAhcQNVLNLJI+Et9cb9IZYE1y48YaHO1K/v7I8D36VVtafYEBmZ5w32gYQFSWopYRnCY DqJw== 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=7xMSbSX6JUqisE+ZC80AlkX0gZxRGpO/C3MZvmfxXXw=; fh=V7uVG1DgPEiI/Dn5AyTMYxZqYu+WhPESNN5nDmV3BtE=; b=paIEtxq40tFUbYFlgMXoHjvS3ohpU/GVf3Bm1PghjAjUHHCCYarDNRs57R0logzCk4 KssxLHGFG1P45JTyAWWJF+CMpMoPTwtafxTf8spoQ7qUNtAd1kFT4q1L/xdQLi3DIOJ3 bOLwg67Ghcb2TIFcd+yEzAWDbG7ZoS32KVY30KT9TtgdzCXGfBsIZKU/OKCdCwzNSdU6 kVXNL98CrZi7upSoQ+2LrdH+RJ8fYLi7Pg2tSNw3vsktE5Y5LPtAQIzimkdxbCXbkgLB ABmwdtuiU7x00WNjiBcsVmkRQNWkp/wBmzhZet1f/gCsmo2jRXLDufGHL5B597AIab08 YOow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LXY91qUU; 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 s14-20020a0cdc0e000000b0067f931f6bf8si2052174qvk.122.2024.01.05.07.54.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:54:22 -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=LXY91qUU; 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 1rLmND-0006qu-Po; Fri, 05 Jan 2024 10:44:39 -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 1rLmNC-0006gb-8i for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:38 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmN9-0003Kp-3f for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:37 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40d6b4e2945so18053825e9.0 for ; Fri, 05 Jan 2024 07:44:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469473; x=1705074273; darn=nongnu.org; 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=7xMSbSX6JUqisE+ZC80AlkX0gZxRGpO/C3MZvmfxXXw=; b=LXY91qUUH1TUmvuQBu09q4hAozPHbS2k9DAfDt+/kStq0aiWQuk8boP1tWxU2Iz0Mh 2Z0HidpLfbAgEh17zxkdnnTO4ZQfFVJx4MHAnX3PKLxnNlSwXMUpnmQYfZgSZ5sOYVLZ WpARwsXsNNln+7mHTjrtxAUXSVnFfHrsggqDP67xhFo7+v1Hf2ngjOz924Wxvl62fZxk K8+Vik8J75c/9euLvAyAHXR2QUaervBwNX2FCxkN2I+UEF/F8ol+SFH8RFmvQmCUIsf4 1FRXD9L4RLmCt1GABjhBFmDLrWAHa6Yf8iNcWA2PHyTfU/iAyZ17VvmWA0MRD9pkzCci 0+FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469473; x=1705074273; 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=7xMSbSX6JUqisE+ZC80AlkX0gZxRGpO/C3MZvmfxXXw=; b=N7KoEkpzaym9HWaoNukbjtnKLaNXPCOdMNh1LqZKeb7PYpA+rd8pTHIsi8KIJqkIaV pAkqsB8Qf7ttRRlFiPiv0Gj6G8Yxgo7/BLZNajk1/+oaEOb3Tl1vb4bKfCcASOWQTSx6 T0LwXW8NjL1g2nqIHyLsquw2/VR6Ldn8nY5MoMwV+E2vgFs7Z5t3T2UFEPtyM86C8NqX 2OsSJiTMFNCPe4srnX59FMEEvvNYbHFaLR88k9N/wN4N3pxOBfTwpC+5OKkc2PFXokTT +JgIC1ZTs7QJNr71W3LLm33f6pSFaiViNyNKMF/2M8ZmBSC+h/3iQ4Tk0PhQM8FKdP78 26/A== X-Gm-Message-State: AOJu0YzHXb+YDpme1xCljgK5i15TL6ffuiD1z4DmME7pK0LvAdlOmG8m U6DJqjYDTi+EvxD+mAh7asXq/cFUnuC7Ly4nAMzw9xR7Q0c= X-Received: by 2002:a05:600c:19c7:b0:40c:2671:1553 with SMTP id u7-20020a05600c19c700b0040c26711553mr827570wmq.36.1704469473620; Fri, 05 Jan 2024 07:44:33 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id fm26-20020a05600c0c1a00b0040d5e53d7c3sm1972654wmb.23.2024.01.05.07.44.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 14/71] target/m68k: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:07 +0100 Message-ID: <20240105154307.21385-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-m68k -cpu ? cfv4e m5206 m5208 m68000 m68010 m68020 m68030 m68040 m68060 any After it's applied: [gshan@gshan q]$ ./build/qemu-system-m68k -cpu ? Available CPUs: any cfv4e m5206 m5208 m68000 m68010 m68020 m68030 m68040 m68060 Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-15-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/m68k/cpu.h | 4 ---- target/m68k/helper.c | 40 ---------------------------------------- 2 files changed, 44 deletions(-) diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h index 6cfc696d2b..d13427b0fe 100644 --- a/target/m68k/cpu.h +++ b/target/m68k/cpu.h @@ -556,8 +556,6 @@ static inline bool m68k_feature(CPUM68KState *env, int feature) return (env->features & BIT_ULL(feature)) != 0; } -void m68k_cpu_list(void); - void register_m68k_insns (CPUM68KState *env); enum { @@ -576,8 +574,6 @@ enum { #define CPU_RESOLVING_TYPE TYPE_M68K_CPU -#define cpu_list m68k_cpu_list - /* MMU modes definitions */ #define MMU_KERNEL_IDX 0 #define MMU_USER_IDX 1 diff --git a/target/m68k/helper.c b/target/m68k/helper.c index 0a1544cd68..14508dfa11 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -29,46 +29,6 @@ #define SIGNBIT (1u << 31) -/* Sort alphabetically, except for "any". */ -static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a = (ObjectClass *)a; - ObjectClass *class_b = (ObjectClass *)b; - const char *name_a, *name_b; - - name_a = object_class_get_name(class_a); - name_b = object_class_get_name(class_b); - if (strcmp(name_a, "any-" TYPE_M68K_CPU) == 0) { - return 1; - } else if (strcmp(name_b, "any-" TYPE_M68K_CPU) == 0) { - return -1; - } else { - return strcasecmp(name_a, name_b); - } -} - -static void m68k_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *c = data; - const char *typename; - char *name; - - typename = object_class_get_name(c); - name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_M68K_CPU)); - qemu_printf("%s\n", name); - g_free(name); -} - -void m68k_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list(TYPE_M68K_CPU, false); - list = g_slist_sort(list, m68k_cpu_list_compare); - g_slist_foreach(list, m68k_cpu_list_entry, NULL); - g_slist_free(list); -} - static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) { if (n < 8) { From patchwork Fri Jan 5 15:42:08 2024 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: 760162 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp104818wru; Fri, 5 Jan 2024 07:47:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEMV/IIpD0i5CQUWV397ucSwr0KVhhdV7o9SdqMFUv+DCp3HLp66TryflOWDZmigSarZaM9 X-Received: by 2002:ae9:ea0c:0:b0:781:dde9:57d6 with SMTP id f12-20020ae9ea0c000000b00781dde957d6mr2053962qkg.84.1704469635284; Fri, 05 Jan 2024 07:47:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469635; cv=none; d=google.com; s=arc-20160816; b=Ag3oEiZ1BH0rBaVySs9aoXBuK1HQEyFSt7ZUyc+xThN1nLbJ62e6MB+8pMMf9ms9PX 1cfPB1MyXJ/nD4a8oK7Wd6ozq2nxqydJNQsC+fIXoLkcT43QyZTEf5NpkgZiNTTRBoRK t/pWNXFkL5lL7yxM8NmcCPqWoLMqnYH0uQAYDhMZE7a+4AiOdV842kKXhaCto6EdR5xy z0KzPTCMwpwtE6b96BaqunNdvuHLDdVq3hzdPLFYm8C6Mn2CWdpac8fg/AJb9J+FVYPb F1OUDYtT2nWcmK1i99Xzbg4qA7Q2qC5qFn8JLCETq/B0AE2ryIu3ENxQ6IQIQzJXpX2O IfyQ== 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=u+LOg4cE3e/L+FkF/kdo/NDds7gIy3v+MrTgt4iIEa4=; fh=zfC841gdzgCR5c4QsvEdZ2DqqzAfHUewN2O6+kLU50o=; b=jDUHrKGA0RiytdmEGhU2M2chgY4OvP74T9j1yZuv3qEe5qgllkcEonbGMLyC6m2JvM odtx98WwRyNrfzW7jgdnUszZwGvdw2oNKfytx2x1apkn+XPYylqT8RTjYGkM32UBUMi7 K2OYwv62cL9N49Av/XMpWZxLf/ImZc0e2Ygap4qHK902+yE5ti+M5T7nTtxXbDOvyGwn 6IoxtugvhSYuwnbOlvpmRxz5NT/oDSONsxwWOrF48hdTftJBnNhqZ1k9pLDUGwQKD0Po 1A9L0eH+YliTlUvqD9cnwdanGTz/At5/Ml4Oj8qyRYnByRlapNgF8sFZtV4yXRD/tbnN LNhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n5kSfdb/"; 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 e9-20020a05620a014900b007815cd670c0si1965148qkn.29.2024.01.05.07.47.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47: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="n5kSfdb/"; 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 1rLmNR-000881-3u; Fri, 05 Jan 2024 10:44: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 1rLmNN-0007sy-P8 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:49 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmNH-0003M3-30 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:49 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3367601a301so1314157f8f.2 for ; Fri, 05 Jan 2024 07:44:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469481; x=1705074281; darn=nongnu.org; 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=u+LOg4cE3e/L+FkF/kdo/NDds7gIy3v+MrTgt4iIEa4=; b=n5kSfdb/lfP7oDDbyCG5oqr7XHssSJaEsPSnUqsTFei00qGvkLC5F377mhnpJvZE/v pe1zbxhC7rYsHfDr+65vayV6/AelRC1ynexpKTGiDSUJddWM6m/EpBQ/fCL/rFzq429v Ies5iUwKXbTH0oWxDVWR8sIqeA8DYXe/lkEy4V63Uw4u6nQcsA+Ux6uvLRFawF55WJKF XOOVx3bzHJaD8hdAwnT7WpEtelvVEmbKO0kap2TItCVTL5G24Prh+j14VtxOnPm8/QNR PKbWArQzkF2Aj28LuacMuelFJJFoV5OHawvWr39qMV+4vM0libGicCScHhvOfzhpSTP7 4Rzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469481; x=1705074281; 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=u+LOg4cE3e/L+FkF/kdo/NDds7gIy3v+MrTgt4iIEa4=; b=MlNPBC+zDVW46Hdqjz9Xwek47oLciFX+C6MibV17yQ7xTYlE4X1YAOZ7Q97OqBjAVz ObC5Tg6yiYA7A4zxs3cPpldujOnsNi2XPfbXz4ZnB8FDyq8bWJZ41baqiIN76xf2hnj4 3BFFS8Pqi6qAJ2vZsiIBMfBy8W3EJHNNdQ6t3WmhnFoUd58nanGB/WC5+3V9bG6dBPxG hNVrct319pX+aGQGWxwhhQB6tRr1bwgYwZD/0FJPTI1zsj6aPlUMCI7ZTHHqX96tM6XZ EPEKIU+d4+KarC5uRh5sJmxF4W+hwZ9S17Ixpv5U4JOFTVHywzqZQ1SVs6dce9Pg3EoP TrIw== X-Gm-Message-State: AOJu0YwfMgkU7XXSsgoXXWiO0qZJuZRMEuuGBIM5FQswviurfrLHBuVZ GHcEAQ6nssAHHx6FmdL4xWO/yu4FjXlMDjeGYLwYPbRdjH0= X-Received: by 2002:a5d:6445:0:b0:337:4e86:ebe1 with SMTP id d5-20020a5d6445000000b003374e86ebe1mr837995wrw.42.1704469481467; Fri, 05 Jan 2024 07:44:41 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id f11-20020a5d50cb000000b00336ebf27d59sm1604796wrt.78.2024.01.05.07.44.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo Subject: [PULL 15/71] target/mips: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:08 +0100 Message-ID: <20240105154307.21385-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-mips64 -cpu ? MIPS '4Kc' MIPS '4Km' MIPS '4KEcR1' MIPS 'XBurstR1' MIPS '4KEmR1' MIPS '4KEc' MIPS '4KEm' MIPS '24Kc' MIPS '24KEc' MIPS '24Kf' MIPS '34Kf' MIPS '74Kf' MIPS 'XBurstR2' MIPS 'M14K' MIPS 'M14Kc' MIPS 'P5600' MIPS 'mips32r6-generic' MIPS 'I7200' MIPS 'R4000' MIPS 'VR5432' MIPS '5Kc' MIPS '5Kf' MIPS '20Kc' MIPS 'MIPS64R2-generic' MIPS '5KEc' MIPS '5KEf' MIPS 'I6400' MIPS 'I6500' MIPS 'Loongson-2E' MIPS 'Loongson-2F' MIPS 'Loongson-3A1000' MIPS 'Loongson-3A4000' MIPS 'mips64dspr2' MIPS 'Octeon68XX' After it's applied: [gshan@gshan q]$ ./build/qemu-system-mips64 -cpu ? Available CPUs: 20Kc 24Kc 24KEc 24Kf 34Kf 4Kc 4KEc 4KEcR1 4KEm 4KEmR1 4Km 5Kc 5KEc 5KEf 5Kf 74Kf I6400 I6500 I7200 Loongson-2E Loongson-2F Loongson-3A1000 Loongson-3A4000 M14K M14Kc mips32r6-generic mips64dspr2 MIPS64R2-generic Octeon68XX P5600 R4000 VR5432 XBurstR1 XBurstR2 Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-16-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/mips/cpu.h | 4 ---- target/mips/cpu-defs.c.inc | 9 --------- 2 files changed, 13 deletions(-) diff --git a/target/mips/cpu.h b/target/mips/cpu.h index 52f13f0363..1163a71f3c 100644 --- a/target/mips/cpu.h +++ b/target/mips/cpu.h @@ -1235,10 +1235,6 @@ struct MIPSCPUClass { bool no_data_aborts; }; -void mips_cpu_list(void); - -#define cpu_list mips_cpu_list - void cpu_wrdsp(uint32_t rs, uint32_t mask_num, CPUMIPSState *env); uint32_t cpu_rddsp(uint32_t mask_num, CPUMIPSState *env); diff --git a/target/mips/cpu-defs.c.inc b/target/mips/cpu-defs.c.inc index c0c389c59a..fbf787d8ce 100644 --- a/target/mips/cpu-defs.c.inc +++ b/target/mips/cpu-defs.c.inc @@ -1018,15 +1018,6 @@ const mips_def_t mips_defs[] = }; const int mips_defs_number = ARRAY_SIZE(mips_defs); -void mips_cpu_list(void) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(mips_defs); i++) { - qemu_printf("MIPS '%s'\n", mips_defs[i].name); - } -} - static void fpu_init (CPUMIPSState *env, const mips_def_t *def) { int i; From patchwork Fri Jan 5 15:42:09 2024 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: 760224 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp111477wru; Fri, 5 Jan 2024 08:01:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPWqybFFk4D/Pf8J9xDWZdzpWDuwCN+ARPjvK0zFgebaAgpT9pbU6A19OQ4a6IrphnTUfU X-Received: by 2002:a25:d24e:0:b0:dbe:3183:2faf with SMTP id j75-20020a25d24e000000b00dbe31832fafmr2190432ybg.74.1704470508766; Fri, 05 Jan 2024 08:01:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470508; cv=none; d=google.com; s=arc-20160816; b=aYkPOroR959qWksYsn1EMCTR+1XPJsCqLm1P13qe824Og3daGbShfScCRNnUA4i9C/ dPu3xFdl8YH/UdpHyTH21DSqx+hP7FrigCjdJCHHF6S54jgdCYjtbt/ycfOPDaJiCq6N pYTnkhu4KWpDSMWJ1ui7aYjz/gEjwOijSEtZJRCjutDIon3Do27ybajywZlPUB9nRkxs u5+maWbJMSVmrmfa8Uc+q9XLCBs50kkYiYPL/RyTIM0Pbl9A3dVySbN65X2znjG5m3kJ zvmUu3VHCoc4OpBAldXzhXRD1Kz43kjnNJwtw42UswGOosXJfronVq5aHw9BmB/XmiTF COiw== 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=yaDY8QYkk1W3Mtkw1yjFTsfcx0RHMGOL7zHOvOfrIZM=; fh=a1xN/CgOl3bPnNtSzkcbaUmnvDqm/pwVthvBJ5ZcXso=; b=eFdkdHITe09wb0h6+sDw3Vfu4fzYSPjvmTBdqt/2P8xbpqEag3dimLwynX7ul2ACdJ 163ZmnSiLKq2oeZPb8ya6gEGckWWhINnHVgcUBvnbmSjt0pDUyDAR9AdvT20OiBCI2Ii ek/dRp1BUrs/NDSuRXXJuf4zM2JGzXsWHNfJZgV0jO1bb1MuiqtwlXEYZk/4qJfptCQR DjgIJtg6ZBZHv5OBbRtiwHerNZkaJrf4xF9+V7UL6YEBGPd5ZbjIZeDC03SU15kGgvDO w1NQ9PLupWQKq7YnrXi0YPLRZKILTLNwqmm+1YPjUC95ocxnHG/93s1UFlQG7CLK02zn 0IOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e0UxCDTe; 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 n70-20020a25d649000000b00dbe9d209942si816927ybg.717.2024.01.05.08.01.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 08:01:48 -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=e0UxCDTe; 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 1rLmNW-0000Do-Hk; Fri, 05 Jan 2024 10:44:58 -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 1rLmNU-00005Q-0u for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:56 -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 1rLmNN-0003Mz-Fe for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:44:55 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40d88fff7faso14847945e9.3 for ; Fri, 05 Jan 2024 07:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469486; x=1705074286; darn=nongnu.org; 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=yaDY8QYkk1W3Mtkw1yjFTsfcx0RHMGOL7zHOvOfrIZM=; b=e0UxCDTe7uC6Btd804/EDt7+PG+Ds0D00DG/EVBQrzOpEe6+QkvJ0DdQ1yGT0xMxU0 9AtLoRfcZSHlExD4IvNCcjuOIrD/DiOpy0Stbt2tLIaf7aQ4PolGj5kVd0skddfr4qpn TtBXQYvfHcNPNDCVH6RgBaWkhxMwbOdKuym0iN7dE73005aeQgZojXflBXNwmiFUlhg4 KFIpm/iRGxopyZN21KKqOyt3rkPiQRfa7NFqw8uOmm6mb2saDC1sKiZQFQI97I+xWZdh Pa3l01zBGOt3podG0IFl4+5ZMxq56KJP+XERACQTScimEqejRxmXqOE7/EbpRCZhEhxk GCuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469486; x=1705074286; 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=yaDY8QYkk1W3Mtkw1yjFTsfcx0RHMGOL7zHOvOfrIZM=; b=Q8QLg8/wteogPgj8cztRQ1v5YmSyE5AgvrKb9M5aUn/yAqnt9U+zEmuYBKmEByQdnp JRuE2FYK3IYBXFj9atVX/MOU3ni6w7ZwgF5fCqAwgNoy71B0IltThCdVCWrgAdsTD6ub vHeqq6unauptb1GTr7eC1YsnlTi7nuulQdSXO5Rd66IB6RUtYr5Qo2wv1yd4yySQnbuk Sfm5mlnRfZg8oqfJPbjdv+7bMUQtkJE5gbxcXa7L1O9LpLNzXQZlb5pwME21DpOQOmeD HQG4z6CFLvXzjdMdzvWDqF4P6l4NxM34v7B1noCLzjzXMClUr+QOYtUs5NmqsWngTFti Y5mA== X-Gm-Message-State: AOJu0Yw7tzVE2/0T2DWMiajQgrCuD/Wzr5tWy/+nwYULq2o9gmrRhW8e LE7TK3CSK50sRzcoCdLrQSHNG14VJ/CVdxcgHWS+aJnuetQ= X-Received: by 2002:a05:600c:450d:b0:40d:938e:6b49 with SMTP id t13-20020a05600c450d00b0040d938e6b49mr697221wmo.131.1704469486736; Fri, 05 Jan 2024 07:44:46 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id q17-20020a05600c46d100b0040e375604ecsm1940574wmo.31.2024.01.05.07.44.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Stafford Horne Subject: [PULL 16/71] target/openrisc: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:09 +0100 Message-ID: <20240105154307.21385-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-or1k -cpu ? Available CPUs: or1200 any After it's applied: [gshan@gshan q]$ ./build/qemu-or1k -cpu ? Available CPUs: any or1200 Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-17-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/openrisc/cpu.h | 3 --- target/openrisc/cpu.c | 42 ------------------------------------------ 2 files changed, 45 deletions(-) diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h index dedeb89f8e..b454014ddd 100644 --- a/target/openrisc/cpu.h +++ b/target/openrisc/cpu.h @@ -299,15 +299,12 @@ struct ArchCPU { CPUOpenRISCState env; }; -void cpu_openrisc_list(void); void openrisc_cpu_dump_state(CPUState *cpu, FILE *f, int flags); int openrisc_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int openrisc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void openrisc_translate_init(void); int print_insn_or1k(bfd_vma addr, disassemble_info *info); -#define cpu_list cpu_openrisc_list - #ifndef CONFIG_USER_ONLY hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index f7d53c592a..381ebe00d3 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -253,48 +253,6 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data) cc->tcg_ops = &openrisc_tcg_ops; } -/* Sort alphabetically by type name, except for "any". */ -static gint openrisc_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a = (ObjectClass *)a; - ObjectClass *class_b = (ObjectClass *)b; - const char *name_a, *name_b; - - name_a = object_class_get_name(class_a); - name_b = object_class_get_name(class_b); - if (strcmp(name_a, "any-" TYPE_OPENRISC_CPU) == 0) { - return 1; - } else if (strcmp(name_b, "any-" TYPE_OPENRISC_CPU) == 0) { - return -1; - } else { - return strcmp(name_a, name_b); - } -} - -static void openrisc_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - const char *typename; - char *name; - - typename = object_class_get_name(oc); - name = g_strndup(typename, - strlen(typename) - strlen("-" TYPE_OPENRISC_CPU)); - qemu_printf(" %s\n", name); - g_free(name); -} - -void cpu_openrisc_list(void) -{ - GSList *list; - - list = object_class_get_list(TYPE_OPENRISC_CPU, false); - list = g_slist_sort(list, openrisc_cpu_list_compare); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, openrisc_cpu_list_entry, NULL); - g_slist_free(list); -} - #define DEFINE_OPENRISC_CPU_TYPE(cpu_model, initfn) \ { \ .parent = TYPE_OPENRISC_CPU, \ From patchwork Fri Jan 5 15:42:10 2024 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: 760171 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105403wru; Fri, 5 Jan 2024 07:48:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgZtbNw0cvmRqeAK9UKgXrnmqpoxpMN9UzdyF5habgEbYanXdU4eZilfXIQviPCI75DF7d X-Received: by 2002:a05:6808:2190:b0:3bc:120:bab7 with SMTP id be16-20020a056808219000b003bc0120bab7mr2517324oib.39.1704469713673; Fri, 05 Jan 2024 07:48:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469713; cv=none; d=google.com; s=arc-20160816; b=Kujzkwfllwkvj7nmFHwrPBU+y+xkTCwiBOV86NPgQgL+Z63o/AqFIGerv6+k7ExcMc Ugj0hEUsUDKcQ5QvVMnKzzyhvx93Vx3dHXhS477TFxto3ZTPRM6T4tRgAYi9cy5zi5cU B8Vq265fedDkhPHCBG8NBaOaqRfrjplANTHOsnTXKxeMOkoT6esdlc5+LDjNeSVfBkmB ZZJNNgGnoEiqg3S6AeeruttNd74B5EJf5VbpQPF+e+o8w+e9c1D4nVwnPKbcL0Z/IwqD pnoFhjFidW3Mpu7YtcFDv+XW4TKd77YBS7zuOl543A2WWfz0xeL9P4xdJIFXkNz3snMr rhoQ== 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=VN0awrbP5OQORGwTdpI9FL1dvbQ4lYRKpoXyYpVskO4=; fh=7r8PsvSqWcS6j0GSKU8TNvB90apLZRO7w2EreKbcrQU=; b=mfDNxT3yu8MAkamDcuamLzZbYE7r0VdvUKYIvQwzVatyA0RpNriIhY34s2GvAi4YZR R+KPhUDUBjmc6cUQyGMwgqdCa9GGvGUI6kYodGfK0xbeLZpN3EcLQBx5yxw+ovun9pU/ qnrLrptAyIqpfWO2pgUuJpHTRAMVPiGC6SsP+NrYfq95h/AM52SQWVXNvt6k9FKofC1k 8v6jmKgGusbI5iRm5xh2e/fFJFQH/85bkJfeCTjcfT50VqoOrOLljLu9SoI2EDHe0nt3 RE8lbKWJ809jM8zYSGrKAgi172gjud/FWkuVEY2K+kDeMHtXPTmlJcE5LtOjkaUy7yhU CbkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uDsRx22H; 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 j9-20020a0cf509000000b00680ccb9cf87si1996585qvm.509.2024.01.05.07.48.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:48: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=uDsRx22H; 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 1rLmNk-0000pA-7r; Fri, 05 Jan 2024 10:45:12 -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 1rLmNc-0000Ty-UR for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:04 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmNU-0003OW-Lf for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:04 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-40d76923ec4so16150265e9.3 for ; Fri, 05 Jan 2024 07:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469493; x=1705074293; darn=nongnu.org; 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=VN0awrbP5OQORGwTdpI9FL1dvbQ4lYRKpoXyYpVskO4=; b=uDsRx22HU9SPJoRjW5EZmUusQOdM5juuuem7KmvDmMSmC21ft5eSOz0A8EelsndkkL yvLdtQ5T2T5dbhwOguPxw3Ouh3UA/UpdLBm+TEOOIe49tUH1AuRvW3zrzVL3jIoooL4e jzNpbPbGf8tGzf4mf/SXHTAU92X1dEtMVbEQf7pNVk8nCIU1VLLBQBB4NdBA1weSdFXN yUPi88L7njaqphZbehhPVtUZ35GmpBYRKLrdWjxn4gx2whGjTNOyrFrnSatbH2H0EoT0 DEKT9FpnXTIpraEGR1sgDuot99Wd9068pIAYMUqsZ0ZXUzRirvhSiDEXdZl0Vr2CdhdD aERA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469493; x=1705074293; 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=VN0awrbP5OQORGwTdpI9FL1dvbQ4lYRKpoXyYpVskO4=; b=fGTzquMp0DMzEmkN2PAkJlRCfgJT/3fMpItXY3CfIGyov10xDC17ISSh16qaQWmFqQ 4t1D3FNh1I6cDhB4O8Xn/FZsWk7VN9U61Q4Ayt4zZ9oDrL5W0gWEvbQCLDMD8VCheK0O 7BbZG6E6WXiKHT2KvvpJQ5skUBMgzS9HJXTS4xdYb/za37itAA3AVRlGDWCzYOazSA4A PQQ/L8P5gx5JzLc6uSs6KnjqbKQS8RMzL+Az5Y9UrA1leuJR3EU7s3VLATwb6wNc+nsE xEzDkH0tvcm+Vc2hGsDwJz/kLbO35yffZ177H/qhUGOcW8SkzJZ48QPM2SyxQjkSYzFX VJyg== X-Gm-Message-State: AOJu0YxInElMEvChfoSBWgZoOCprLlkfHZ+ayY8jJyylxWDJognWUv5N e7aCR3FAnCcMGjvAhHdrxtEGkNbFXtd4SCt3Ezyu6jegqMg= X-Received: by 2002:a05:600c:5487:b0:40d:877d:ca1 with SMTP id iv7-20020a05600c548700b0040d877d0ca1mr1218138wmb.54.1704469493513; Fri, 05 Jan 2024 07:44:53 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id l8-20020a05600c1d0800b0040d6e07a147sm1938605wms.23.2024.01.05.07.44.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PULL 17/71] target/riscv: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:10 +0100 Message-ID: <20240105154307.21385-18-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-riscv64 -cpu ? any max rv64 shakti-c sifive-e51 sifive-u54 thead-c906 veyron-v1 x-rv128 After it's applied: [gshan@gshan q]$ ./build/qemu-system-riscv64 -cpu ? Available CPUs: any max rv64 shakti-c sifive-e51 sifive-u54 thead-c906 veyron-v1 x-rv128 Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-18-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/riscv/cpu.h | 2 -- target/riscv/cpu.c | 29 ----------------------------- 2 files changed, 31 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index d74b361be6..2725528bb5 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -490,9 +490,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr); char *riscv_isa_string(RISCVCPU *cpu); -void riscv_cpu_list(void); -#define cpu_list riscv_cpu_list #define cpu_mmu_index riscv_cpu_mmu_index #ifndef CONFIG_USER_ONLY diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 523e9a16ea..22d7422c89 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -1733,35 +1733,6 @@ char *riscv_isa_string(RISCVCPU *cpu) return isa_str; } -static gint riscv_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a = (ObjectClass *)a; - ObjectClass *class_b = (ObjectClass *)b; - const char *name_a, *name_b; - - name_a = object_class_get_name(class_a); - name_b = object_class_get_name(class_b); - return strcmp(name_a, name_b); -} - -static void riscv_cpu_list_entry(gpointer data, gpointer user_data) -{ - const char *typename = object_class_get_name(OBJECT_CLASS(data)); - int len = strlen(typename) - strlen(RISCV_CPU_TYPE_SUFFIX); - - qemu_printf("%.*s\n", len, typename); -} - -void riscv_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list(TYPE_RISCV_CPU, false); - list = g_slist_sort(list, riscv_cpu_list_compare); - g_slist_foreach(list, riscv_cpu_list_entry, NULL); - g_slist_free(list); -} - #define DEFINE_CPU(type_name, initfn) \ { \ .name = type_name, \ From patchwork Fri Jan 5 15:42:11 2024 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: 760189 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107113wru; Fri, 5 Jan 2024 07:52:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1KbUu0Ir8Eucb2rlzkdn8P09pkaLF/tlw1lqyocSlenIMYVBT9A+uA2Sx7C4EmFR/9f6R X-Received: by 2002:a05:6214:301a:b0:67f:da1f:8cec with SMTP id ke26-20020a056214301a00b0067fda1f8cecmr2268672qvb.131.1704469951452; Fri, 05 Jan 2024 07:52:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469951; cv=none; d=google.com; s=arc-20160816; b=Yv5yi7015gijStd1kYo4J8WRYqtBPZDDqL6z5EndfOYbjmEoCgZS3602c14q5kSgij jqV2gSxC1zgvv9udIR1JZ577rzw2eKGgMMpruFuaRN6XGL3chKNNFZbn+Xj/2YChtGFP g37RZ1r2mlPRGET/wxFdN1ylfuHrpNTsv8utxTT3HIntG+pJU2DmZG1isS+ac1FxfGcr GwOGCkd5fIfqBIZSPszezPxNLqH6QkMrpfyW4qygReANZ5Mthl6j6F+jbmCb23642Uj/ 5c0kzZ8NxNuwRUwI4VHaKflmj3r6QP6IMDCgBAo11ABfMNIgijmxSyybuu+lMd6L7Xi9 sv5w== 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=QZuAr3GGN/pOvffPY8+fLddBxJHGJfB6Dvfc17Jcg0E=; fh=n3A7I0RXIS7uKZCl3vDOUiEmSqJiUZA8z++zyYBsP3k=; b=I0SgKc0iypTsQSiw+1ze8ol8X9NumMOI2k2pl8YXmqU+2Mx46jKYvrqKVkfF48wJsU 1aE7n0DRP+zPUzLjck1g8LYYWgkfbd/M6SQzwIgg+UUQYytCBdXGASWYuk+58kNvgQ3+ sSM0qW28jzWcYJ05zW+UZPfgkvzH+m80y2DqbJ7z2OTLCWAb4FpITndtExM1/+9lkh8n 76nAzXbXnE3KA4mJWk0z/b51I4pn2DyiRMeYsGaCEoH9COBHA5Et8mpsoBhtaadMu59A Z2D/mCkuTDD37wBoC6Gs8MIO4WiIpk0Ol1EvFYLimmYMTshj7YQOdj0C2STIOwvvs4v2 tA1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hQiB8IA1; 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 t17-20020a05622a149100b004297bc72149si787888qtx.154.2024.01.05.07.52.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52:31 -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=hQiB8IA1; 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 1rLmNs-0000jE-0u; Fri, 05 Jan 2024 10:45:23 -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 1rLmNc-0000TB-AS for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:04 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmNZ-0003PU-CF for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:03 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40e3b43173eso2025055e9.1 for ; Fri, 05 Jan 2024 07:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469499; x=1705074299; darn=nongnu.org; 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=QZuAr3GGN/pOvffPY8+fLddBxJHGJfB6Dvfc17Jcg0E=; b=hQiB8IA1hhYuYpdQNeCxIID2eAzyigfnquvRK+W0GKHdvwtMiaE4WLwvzI58qlGIWN l5BeDm0XbIhRqlK3yHTMhPBVNtAGuRnd5jb4w0bi9vJS4ZJ6kQ4zftDEJzlwwv9/bUwx QqIiBRmLKqqXXcaytTmeWYTj5YQOelenLOqrPkKCN/F8Bv9P9Aj/0IPYdNrkHngA11Ow XW1ngewoFSpeB8+270VllBuriwO9XEsVZH6ZSFJ4xgwE3jyNPmIfcc5pyxEtf65EWv9k NMEGozYDQCbEqX9y+DYEjtJWRSY1YBAbGeh1kKvy7wi6wmZmxR7VUbUi50GJpM6Ee+r0 /DAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469499; x=1705074299; 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=QZuAr3GGN/pOvffPY8+fLddBxJHGJfB6Dvfc17Jcg0E=; b=fK3qHfg1NFJzO0oCGoI3ovr3h1NWINnkXxmWavlBOBthemG9q7c/YN5Hf8h8wPMiHl CPV7tZYKeKCG8KUtCJAAx+anLPbxgwsXATQ0LPUVMelxnEz30TixBrUapOjY2nBFG+5A Vu08zmJBQOIg5wB+PDD+ZINFP9kLBUy6c2h6dOVT3/B3qmwcAep8a8S11dPzSR5fBH/U Ac//5+SpRa24aH7vNaJnAobzTbIbKxro/EB9K0maCd+Bdoe8T32/qzqfLbYLww/cJGdg 8NIo475TjcWqvee2R/4oXpIGszWvFqjFSnKKYuFP2dHGfih3lAmRgXnT+u7GxWaoo6aS u1tg== X-Gm-Message-State: AOJu0YznMbJWUIYfQDUCafuTib7qHZ9Ovw6CGcDD4qAkBXg35XhoUO1n GkB2fDAbFiQFa646vB9FHWQwyP4ft2JNIGj77XOUtrAVA/E= X-Received: by 2002:a05:600c:510e:b0:40d:190c:160f with SMTP id o14-20020a05600c510e00b0040d190c160fmr885239wms.110.1704469499779; Fri, 05 Jan 2024 07:44:59 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id fl13-20020a05600c0b8d00b0040d8af75e19sm1958682wmb.24.2024.01.05.07.44.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:44:59 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Yoshinori Sato Subject: [PULL 18/71] target/rx: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:11 +0100 Message-ID: <20240105154307.21385-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-rx -cpu ? Available CPUs: rx62n-rx-cpu After it's applied: [gshan@gshan q]$ ./build/qemu-system-rx -cpu ? Available CPUs: rx62n Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-19-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/rx/cpu.h | 3 --- target/rx/cpu.c | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/target/rx/cpu.h b/target/rx/cpu.h index e931e77e85..65f9cd2d0a 100644 --- a/target/rx/cpu.h +++ b/target/rx/cpu.h @@ -139,11 +139,8 @@ int rx_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int rx_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); void rx_translate_init(void); -void rx_cpu_list(void); void rx_cpu_unpack_psw(CPURXState *env, uint32_t psw, int rte); -#define cpu_list rx_cpu_list - #include "exec/cpu-all.h" #define CPU_INTERRUPT_SOFT CPU_INTERRUPT_TGT_INT_0 diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 9cc9d9d15e..c5ffeffe32 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -89,22 +89,6 @@ static void rx_cpu_reset_hold(Object *obj) set_flush_inputs_to_zero(1, &env->fp_status); } -static void rx_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - - qemu_printf(" %s\n", object_class_get_name(oc)); -} - -void rx_cpu_list(void) -{ - GSList *list; - list = object_class_get_list_sorted(TYPE_RX_CPU, false); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, rx_cpu_list_entry, NULL); - g_slist_free(list); -} - static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; From patchwork Fri Jan 5 15:42:12 2024 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: 760167 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp104994wru; Fri, 5 Jan 2024 07:47:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEe0SLky7cG+2R6bNCUKWh8dUUW4F/fEJ6SvCTWyhjR219z7Ngs5K+QbFU31cSWZLxlDrW1 X-Received: by 2002:a05:620a:640f:b0:783:48e:aa29 with SMTP id pz15-20020a05620a640f00b00783048eaa29mr3518131qkn.49.1704469658552; Fri, 05 Jan 2024 07:47:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469658; cv=none; d=google.com; s=arc-20160816; b=kv0UPbgN2qCcqCszrZhg9b9RTSfazcLUfSVcp1CkpV9g+yajD1eLJBjj7OnSPRG2W1 HixtO/TkJCJ/1u/+7NlwMRHMznJZnjzeoKynPamyFxmarsD9CTIvYLNY9RnjqAq02ZPI dHoXpEZl/F24Aw1uqGhi02QaFm/QjNrDHv27dxlbZFLOGZRsVXCwQW+O6RlZgoImBU6B nxCyA4F/H9s+bQekkKQLmIvFa40nTgMYiptbd5d0Dqn+InUWG9ELRbRF9vR1XEtEdGEV MRUlFlfd8o+zuFr6RXCLvxa8+yjJ/fFrlHUETdEy0fI23+8iFTzUwO+LaVA+9MvXwjpu VM2g== 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=24gk9foSLxYRl9r29iWk8lo8oQhlMpaHzfjXYQc2w0g=; fh=n3A7I0RXIS7uKZCl3vDOUiEmSqJiUZA8z++zyYBsP3k=; b=GZPo2x8HAaedhIeQ0X9zg+WK1TvtOA3K00BlecmtOSpocV/JmBbkhDW4HUDniizHGw LAWYztdR96sveUEBw2BpV6Vxz95DPHWFoy/MFKS1XisE1lCbzTxe2u0Ib388rhugmm6k yJJVRGXTsrYs0cgS8HW7M53uJj56VURJ9m4X120iGc9QEXeUh4kBkz2QR1RpRZZ4NoJy L1whqmrjewcaRxiDgxs8zIa6yF29cQ11KH6OlF9wy7FvBLCjs9BGlhDyhvJFsg3U8WUK LBjlgTc8ODxP6E+bOSHlUs+5vg8tsNSyFv+Z5+CeLyw8j7oo9mFLeyuRR9KkIN0OEZHe CuCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Z0Za4Xu/"; 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 w25-20020a05620a0e9900b007817205ca28si1955419qkm.283.2024.01.05.07.47.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47:38 -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="Z0Za4Xu/"; 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 1rLmP9-0002jF-Qb; Fri, 05 Jan 2024 10:46: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 1rLmNl-0000x6-7X for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:20 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmNh-0003c9-Pu for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:12 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40d858c56cbso19542055e9.2 for ; Fri, 05 Jan 2024 07:45:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469505; x=1705074305; darn=nongnu.org; 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=24gk9foSLxYRl9r29iWk8lo8oQhlMpaHzfjXYQc2w0g=; b=Z0Za4Xu/w0dNjdmtf3ySVKB5dtUAAFIYjkirdl65q6kjc8SqOYSu0x8AHH53VoBcYP DxEtSaBVn8e+hbzgf3M94NDMvVUf+XdyF2Ta8pxuBZ/Tfn66M2CFd8NSfe7CkHwKfAfX cX7PPOfmkdKUJj9rASrpe07m0YMR07g1ysWqsHLbUg8jImO5IPoNRmGMN7VHCSFf5Xzc X6Qnf0z6D5UyBZcFDMXx0Hq7jFC/pWA0YC0JK0dnyyPhnbT8/A01Phh6SIe+DSb93422 FQLV+aRYxPcGdQeOeo+Gv+3q1xZjY5YKqphgBxxbQuYCCOKDzJLuTxgMGoCzcxpD34sL r5Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469505; x=1705074305; 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=24gk9foSLxYRl9r29iWk8lo8oQhlMpaHzfjXYQc2w0g=; b=KoWOyktMFSkBiE1XpSVSmibBT/DfipktDm/Kzmj5PZm71CGhPH6TsKqso6DsIIgoAn r9SScIb548MkXefZTkonTMaJsazIniGmtd8wsI7FzjiwQRNpZGWvoVoHl/kIbUevWFxs UifiBTFv3fnBru5R3baTpFjjsipQ0kXLVgnDU12PNuC5ms9mLjimNZ5JhgNogCskGDZF fc02dCXtgvlefneIL9+wLRuuYEoxFemgTZns8NOj/UcPz0MDPiGEY9/qlv7KH2wfdFDr lRKT1hhBi4Vqfsp33RtXBUR6UP5vRsB6lYKj4mhA3aVYLEO/G9vD442bVsGGu4SIAANw R+tA== X-Gm-Message-State: AOJu0YwsTVVYrfmVIu6ihqVhH0Y0C6N2RCj+P/NjvtuocP9b6fMSMnMi 9iDMKHprWCfZJUfKv6j3ORY39rXNaHGWRYq0synrf5t8exg= X-Received: by 2002:a05:600c:1d17:b0:40d:850b:a19e with SMTP id l23-20020a05600c1d1700b0040d850ba19emr1407108wms.82.1704469505433; Fri, 05 Jan 2024 07:45:05 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id g11-20020a05600c310b00b0040d94b65342sm1915385wmo.48.2024.01.05.07.45.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:45:05 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Yoshinori Sato Subject: [PULL 19/71] target/sh4: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:12 +0100 Message-ID: <20240105154307.21385-20-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-sh4 -cpu ? sh7750r sh7751r sh7785 After it's applied: [gshan@gshan q]$ ./build/qemu-system-sh4 -cpu ? Available CPUs: sh7750r sh7751r sh7785 Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-20-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/sh4/cpu.h | 3 --- target/sh4/cpu.c | 17 ----------------- 2 files changed, 20 deletions(-) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 031dc0b457..0e6fa65bae 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -238,7 +238,6 @@ G_NORETURN void superh_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, uintptr_t retaddr); void sh4_translate_init(void); -void sh4_cpu_list(void); #if !defined(CONFIG_USER_ONLY) hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); @@ -272,8 +271,6 @@ void cpu_load_tlb(CPUSH4State * env); #define CPU_RESOLVING_TYPE TYPE_SUPERH_CPU -#define cpu_list sh4_cpu_list - /* MMU modes definitions */ #define MMU_USER_IDX 1 static inline int cpu_mmu_index (CPUSH4State *env, bool ifetch) diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index a8ec98b134..806a0ef875 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -122,23 +122,6 @@ static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) info->print_insn = print_insn_sh; } -static void superh_cpu_list_entry(gpointer data, gpointer user_data) -{ - const char *typename = object_class_get_name(OBJECT_CLASS(data)); - int len = strlen(typename) - strlen(SUPERH_CPU_TYPE_SUFFIX); - - qemu_printf("%.*s\n", len, typename); -} - -void sh4_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list_sorted(TYPE_SUPERH_CPU, false); - g_slist_foreach(list, superh_cpu_list_entry, NULL); - g_slist_free(list); -} - static ObjectClass *superh_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; From patchwork Fri Jan 5 15:42:13 2024 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: 760169 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105127wru; Fri, 5 Jan 2024 07:47:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBPGtNP3JZ/V1NqvVAk5qjLyGDlyqWYf4tsqFDTEvpHAZ9ensVXTec+hQlH/K78cDfGIDE X-Received: by 2002:a05:622a:1006:b0:428:309c:eb66 with SMTP id d6-20020a05622a100600b00428309ceb66mr2588709qte.133.1704469677940; Fri, 05 Jan 2024 07:47:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469677; cv=none; d=google.com; s=arc-20160816; b=Im9NtU23A4pt0VSRT/GcF4xMYaKkg9E8P6tLK/1/dCAoTtBOl27BHnkQtCv7nipOkL s+/dSxgvxzpgyLD8kwtBPDV0dPXXZwDBS6kZFwD/wGwFQNikmHY3FapY4DDHMNrdwKuo DX/Uz0u7e4GDUMGt8QQ+2shhI3sYcByfvvppePk0u11oeTgtSMQgeAozlcUjCPCsKTcy qSbpUQv+Oz2YPLdjzBD66Z6bvdXZlnQ8SYMlL/RcKNhru4WbXzCSWXUr6sVCPS4OCE8J TMJKlRsd8scM5YRVYWLIhhiHMcJL7+eLuCwBuVZ+rPizvzaXgUxVoBeiQz+AvIuWJ24q W89A== 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=35Qj0GQ7d4D1oUKsUxN1TKydmHhPRhj2Vw6etTCLPUc=; fh=H0WIw/NHiiCiwDJxIX92QzZyeLHCYfKeqgKtC87XE+8=; b=wW/FdyjEzHTUKjeN9FI8x6CZQmvsEO2XPSGl7QBWDjOBiJu/YHWjeEsZF25ZS1Qq7s dYrjBp9yXmfvruJmwdqRXaAvpsAIpRYlMvZBXzAZ36g6LwzZuu8Pn+qI6YThkEYkb1KS Deie+W3eJAsvM+x6jUMiTj0ilsUk3TXwhS4Gq4+HT9onXkmgIfLu4pMtJ7RttZEj/UaJ qA4kLJVtgciY7BuckAystX/FzvU1L98NdAjQJYCCD2EJuYt+RSb5cwZdmq8CyhwxMpvp TxLcJIdfQjdsbdlxjhUk5TVKMt51IRriT0jGX56wSGVHn9pnf/Chxg2TIpIwNTXZFLdd H4Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SXSzjN5z; 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 t9-20020a05622a01c900b0042837904cb2si1988110qtw.89.2024.01.05.07.47.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47:57 -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=SXSzjN5z; 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 1rLmPC-0002yJ-6l; Fri, 05 Jan 2024 10:46:42 -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 1rLmNv-0001K3-4s for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:24 -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 1rLmNs-0003hg-71 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:22 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40d2e56f3a6so4014495e9.1 for ; Fri, 05 Jan 2024 07:45:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469517; x=1705074317; darn=nongnu.org; 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=35Qj0GQ7d4D1oUKsUxN1TKydmHhPRhj2Vw6etTCLPUc=; b=SXSzjN5zWyCXIfuZZULVsIf/YAdeDLpQCLtYiKQhEQtIHCOg/tCEsdJN/o+54bniXf yxCOPKOOmUMnEo+/5umcL85i2lGcovdlzX8xbcn9evrNe7kQR+4piIgVl1P9rldaiL9f Y10HYqmNWsjYgE/jhxw8Owjwv+s62l145nLxzWuyOZBAHgSyOfQ1VVmttTr6ns2New1C o8N0VNsBPdGTbDdABtt5Z4wW67LwmimbgAuCpVl7ZEe368NIYezMmtJ04nlc7koX8rmt gt8CHJ4ZFgksOIBFouDmTwHKsIg+Xy5CnWtA5RBSrstj4WzONT+nHi9cy7BdQI4oR7D6 66mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469517; x=1705074317; 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=35Qj0GQ7d4D1oUKsUxN1TKydmHhPRhj2Vw6etTCLPUc=; b=rI1PjeWD7HPnLNdjd/pv+ks14VynZnZDXcmh48ar9WE0uSKN4DiJrVxV2w0tY6j6p6 IojGqhdjfIkkMKF7zgfV0JHHHtNJ23oXix4v6p582xZ+gVGFmrkPE4avyvaNThQ7CRnc 5NDcpFGuqSy8ebSnwkC44erfo+6+1bbu7nhDGE2idpkN2Xx2gTTzCuAadGjgKOX1HNoO /beCDF187zW0ijGy9Cg19GyMHQNSYe7Sn5QSjTo4jeRWmNmVvb3afCUut4VbEvMBi/v8 ujeBk/ctp2Fq3wnEWCS9Wpz8FWQfu+QBmUpHHEchoXesUAI+FcPsZGLVK92c5DZHkFyB zxFA== X-Gm-Message-State: AOJu0YwK431/0YqEDl2g+u2f8i20qNYjn32GVNWS4wnhdjMbgLOh1aim rhtUmaXAr4w9YJDRjtu54mX9w8q25FPkDXMXmsERZ1iu0dk= X-Received: by 2002:a05:600c:3482:b0:40d:922c:3fa2 with SMTP id a2-20020a05600c348200b0040d922c3fa2mr1276114wmq.166.1704469517228; Fri, 05 Jan 2024 07:45:17 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id i1-20020a05600c354100b0040d8ff79fd8sm1942471wmq.7.2024.01.05.07.45.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:45:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Bastian Koppelmann Subject: [PULL 20/71] target/tricore: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:13 +0100 Message-ID: <20240105154307.21385-21-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan No changes in the output from the following command. [gshan@gshan q]$ ./build/qemu-system-tricore -cpu ? Available CPUs: tc1796 tc1797 tc27x tc37x Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231114235628.534334-21-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/tricore/cpu.h | 4 ---- target/tricore/helper.c | 22 ---------------------- 2 files changed, 26 deletions(-) diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h index de3ab53a83..2d4446cea5 100644 --- a/target/tricore/cpu.h +++ b/target/tricore/cpu.h @@ -246,10 +246,6 @@ void fpu_set_state(CPUTriCoreState *env); #define MMU_USER_IDX 2 -void tricore_cpu_list(void); - -#define cpu_list tricore_cpu_list - static inline int cpu_mmu_index(CPUTriCoreState *env, bool ifetch) { return 0; diff --git a/target/tricore/helper.c b/target/tricore/helper.c index 7e5da3cb23..174f666e1e 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -96,28 +96,6 @@ bool tricore_cpu_tlb_fill(CPUState *cs, vaddr address, int size, } } -static void tricore_cpu_list_entry(gpointer data, gpointer user_data) -{ - ObjectClass *oc = data; - const char *typename; - char *name; - - typename = object_class_get_name(oc); - name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_TRICORE_CPU)); - qemu_printf(" %s\n", name); - g_free(name); -} - -void tricore_cpu_list(void) -{ - GSList *list; - - list = object_class_get_list_sorted(TYPE_TRICORE_CPU, false); - qemu_printf("Available CPUs:\n"); - g_slist_foreach(list, tricore_cpu_list_entry, NULL); - g_slist_free(list); -} - void fpu_set_state(CPUTriCoreState *env) { switch (extract32(env->PSW, 24, 2)) { From patchwork Fri Jan 5 15:42:14 2024 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: 760170 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105189wru; Fri, 5 Jan 2024 07:48:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9ijOZchCF+YbJEU5CYYzQUd2uaibDVBo65AV+cyD4NN4WgSs8/qoFyakWjyA5mcC+yQh/ X-Received: by 2002:ac8:7d01:0:b0:428:31bb:f66b with SMTP id g1-20020ac87d01000000b0042831bbf66bmr2608614qtb.33.1704469687257; Fri, 05 Jan 2024 07:48:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469687; cv=none; d=google.com; s=arc-20160816; b=oVCUIy94dJuHCmkFLsqLRVmlYOjIv3G7Ja1H2FY9VFYT3K5kdHujzdpNQq0aPX+Dbn hQYj3SPV4vpp8+fojBwM8whf9C7c9R63P/dV2yLYPi6e0dFez/zl0yRG5lseBn9k8wI8 aTR9+zp8l4M54BqE/7IQAMozkpnGfu9ykCDiUrlXB9LBydRpPZAE94l86LcZNP0oBVH3 RMWqZ4YaLx7/S9EL8A3lnJcnRQSTZGQGri/jUv3NxsWYQ/awUG/tdOzpcJohgs735NsR MmC9CakueiCI14hVnXgt4wGUyyTDvGw7gc0S+Xcg18MbfEFow6yaH5bYJGUd7md3d33M hHiw== 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=amIzVl4R3+PRNgzKiNHopIA/d217u9I/36YG2i2vTZM=; fh=EffBFCgdZIL4LPk3Vbs/dTsBkj9cOUXHQrnKN2XKWQw=; b=Yv4u66VfWl33dQfMvovKL73m/xWA+YXeVU1JdnqtmtY/X+zRaSrPSdrvOFSvSa+LcM 3kMMoCBWIBkJaEwAqZrUj3kWNe3E/mhjmWLhYwSxCB3vbCsrtwQVn94GsZnh2SRMo6Ss tjLSAZV0uMwWt2xJU/nvZMArsSlPVQ2dQ+U5GVg/OqL3aBRt6LzwMOfc3nhX+xXWOmGv 4qEvRsOwPAmqHaoc+mmsAiYYybMUBq/twkh+XDBPqWFDzq7jPDO9PE/dunyl4amyqF8S L7KLC95J36YK3PQ9o/GhGN0rd3HZffTHbMc3FXvQREjdXnWU+iCNwS/mWeqmqHL+D+2R 63iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jo4c14uM; 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 2-20020ac85942000000b004297b53b3a3si896777qtz.806.2024.01.05.07.48.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:48:07 -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=jo4c14uM; 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 1rLmPC-0002zZ-CN; Fri, 05 Jan 2024 10:46:42 -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 1rLmO2-0001NS-NK for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:35 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmNy-0003jr-PR for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:30 -0500 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-337520892f7so389818f8f.0 for ; Fri, 05 Jan 2024 07:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469524; x=1705074324; darn=nongnu.org; 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=amIzVl4R3+PRNgzKiNHopIA/d217u9I/36YG2i2vTZM=; b=jo4c14uMlTmfF7eTggkWu51n178e1EZRoMEUHTEbJi2FO0JGfgbLcSV8d4fTEzouPc uZ75aS29g4RJRozIdJQmXqC8F5pxlC32ao+vUeZZQFmdvgVHcLAXS1dC3AMCUOduJ0ir Gv6cgk783qjPXF2Lrga1PYOFRfmRV2D6yOF+bw+JIitCKGkYolpU8pbN3onp4kRVHvdI 3088w1Syvt1/9ce1RN3SbCkaJ09m8+0x2F+Kc1dgW0nV4TxFkMOOgPYfhDgZTMbIJ3b1 gs2Bvsz22P7LnoCCG4IHrvMA4IrbxeCidQU7fKV6M8fFIJuYDj7d7/j3bILKR/QYqJ1+ cYMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469524; x=1705074324; 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=amIzVl4R3+PRNgzKiNHopIA/d217u9I/36YG2i2vTZM=; b=S6jJF0RF2PZnNOsZ6PTMUyorqqSBYzVyGRK2lPXIT2tT87fQ+/TznuZ7EKYbD/Ao0G H8Cm839ZILGWOFROY8DjpOXV/IbbZg9t/0pyLgcWfBXvLqf3txF76ifwMnDKwpHw2D7z YGeDORQ2xLncKikNVOJYNJiy14uLXRhs62cXSuZLIDo5M4h/g2NWrrEygj2vlOeKpWjy kgjA7HZuKbifcl3i+AEbbNdi8MypphEClZbJflFdAdLE2owbPwIA+DUdQ2HJwFrbYjem qDvw7D7AvzgxAHB1QWv0BdoCe7Y82VFDyxNbVkyUFaXaLecKUY7egISEdp70Uv/w7sWd 7Q4w== X-Gm-Message-State: AOJu0YxO0m7VRtle7sok6ZWfrESdNMIcNsto0Flbrh5XDXvaokCOY32O fwv+u9ZFXH4bN4Rhl/zCJYQKmOnMsijlZGv4Vf6l22RRhSg= X-Received: by 2002:a05:600c:34c7:b0:40d:5ae4:a487 with SMTP id d7-20020a05600c34c700b0040d5ae4a487mr1247589wmq.25.1704469524057; Fri, 05 Jan 2024 07:45:24 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id w15-20020adfe04f000000b00336471bc7ffsm1592013wrh.109.2024.01.05.07.45.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:45:23 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Max Filippov Subject: [PULL 21/71] target/xtensa: Use generic cpu_list() Date: Fri, 5 Jan 2024 16:42:14 +0100 Message-ID: <20240105154307.21385-22-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=philmd@linaro.org; helo=mail-wr1-x436.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Before it's applied: [gshan@gshan q]$ ./build/qemu-system-xtensa -cpu ? Available CPUs: test_mmuhifi_c3 sample_controller lx106 dsp3400 de233_fpu de212 dc233c dc232b After it's applied: [gshan@gshan q]$ ./build/qemu-system-xtensa -cpu ? Available CPUs: dc232b dc233c de212 de233_fpu dsp3400 lx106 sample_controller test_mmuhifi_c3 Signed-off-by: Gavin Shan Message-ID: <20231114235628.534334-22-gshan@redhat.com> [PMD: Split patch in 2, only include the "Use generic cpu_list" change] Message-ID: <51ffd060-b2f8-405c-83e1-a0663c0183f5@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- target/xtensa/cpu.h | 3 --- target/xtensa/helper.c | 9 --------- 2 files changed, 12 deletions(-) diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h index dd81729306..d9c49a35fa 100644 --- a/target/xtensa/cpu.h +++ b/target/xtensa/cpu.h @@ -600,8 +600,6 @@ G_NORETURN void xtensa_cpu_do_unaligned_access(CPUState *cpu, vaddr addr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr); -#define cpu_list xtensa_cpu_list - #define CPU_RESOLVING_TYPE TYPE_XTENSA_CPU #if TARGET_BIG_ENDIAN @@ -626,7 +624,6 @@ void check_interrupts(CPUXtensaState *s); void xtensa_irq_init(CPUXtensaState *env); qemu_irq *xtensa_get_extints(CPUXtensaState *env); qemu_irq xtensa_get_runstall(CPUXtensaState *env); -void xtensa_cpu_list(void); void xtensa_sync_window_from_phys(CPUXtensaState *env); void xtensa_sync_phys_from_window(CPUXtensaState *env); void xtensa_rotate_window(CPUXtensaState *env, uint32_t delta); diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c index dbeb97a953..f6632df646 100644 --- a/target/xtensa/helper.c +++ b/target/xtensa/helper.c @@ -234,15 +234,6 @@ void xtensa_breakpoint_handler(CPUState *cs) } } -void xtensa_cpu_list(void) -{ - XtensaConfigList *core = xtensa_cores; - qemu_printf("Available CPUs:\n"); - for (; core; core = core->next) { - qemu_printf(" %s\n", core->config->name); - } -} - #ifndef CONFIG_USER_ONLY void xtensa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, MMUAccessType access_type, From patchwork Fri Jan 5 15:42:15 2024 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: 760163 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp104958wru; Fri, 5 Jan 2024 07:47:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFcRK0fh2SfVsWVP2I+JVTAZovUiC4PdxxVb/ZKxaifUSSYDQ9D4rfsK6ZTqYPp5ltqoAp X-Received: by 2002:a05:6358:948b:b0:170:c1a7:254 with SMTP id i11-20020a056358948b00b00170c1a70254mr2518668rwb.2.1704469654805; Fri, 05 Jan 2024 07:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469654; cv=none; d=google.com; s=arc-20160816; b=rVAhcdH53cF5tfwQWVwA1AP9Pnc0B4EW8X7r7j2xCvJVud8JEt1qExNxD0Cf04muEY XDXzqOTgV8Tu55UIQ9RnhZpI3AHTdQVJokE+gr710BxjfLPi5JmVFj0ebQ3+SMWz+QjM dQpkUg6WiKUheVMXeWFV9qP959QQC65CdGJxnMsn7BOwnZ27sg0HBl2/OP5JW5SAWISU K3MQstWLH0egWS9BoasnnQjX64vhZS130GyhNx4aCZGhygNsvAWSBO4SloShjNieKEKa g+bU+jDgnuG1h+Ecp9hiQsdt/vSTkuNbEAWMoZTGYui8jCX0guRGTLvDKCJJVkYI/6nD B3fA== 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=e4mZu4dIothIAeIYl7XbtHN8Q7Ylsc498FBOxXuUI0M=; fh=5Fcc8ne/7jBTspg7DWD7UgKnLXWDdmu9lBysCPsEkFg=; b=l7HEEXdJDRe9LiCNVwukcFWkMSOQD8BiAoMQAj1NCIceMSjpgbMHJXLfkGd9736QCe h+TzyefIt8NanA7XPB/nSVKRC5WxZyT3DolyejAWQP0pzqZjy1VA0+rmCmfG4OL/3Uc3 2bde1Fv0dX3YLXAGiKP0HeY+M79txwto1909h8ulJaT+yuMkW5LO7+RXoFOOrI+zXyna xrg7RID5AmMROYM3qscBmLOjr1RPVTuf50emFqu1DlLu+pdeRVu8hky9JKt6MH9S400J TCbpwQuCWL5HEJuwTkkLnvqYyO8aTS4RRRxrVXTawNewg0YtFOLNhBQjBU6eAVdtvkwF 2LUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HH2M+j4y; 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 o10-20020a05622a138a00b0042830ee0c20si2051267qtk.128.2024.01.05.07.47.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47:34 -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=HH2M+j4y; 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 1rLmPF-0003HG-2y; Fri, 05 Jan 2024 10:46:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLmOG-0001Tm-H9 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45: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 1rLmOE-0003lb-G8 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:45:44 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40d76923ec4so16157925e9.3 for ; Fri, 05 Jan 2024 07:45:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469539; x=1705074339; darn=nongnu.org; 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=e4mZu4dIothIAeIYl7XbtHN8Q7Ylsc498FBOxXuUI0M=; b=HH2M+j4yRxWzQcnuQvd5Y/pUTR+1/p1Y2UdaJ6hbg9KQ4DP94ihA8QEvcVHoqzAFUY m6O4jdu1aPujtudvL8mX4+zdeif6w/9+jYsFxkpSATRzjxYLvWLsHEbU8fsXpzb2hma/ Qok1uLqIBr6PQhkc2VPbwPLTD9wgqOFNi8jAFBcnwYD7R6W+NhST/5wSoIJgs1oy0EIq kosYve95eJM13WZgIeHUC6xQxnfmwG7a8KIOIWOE4xZX2i3oA8T1BaEAVQt+Z9dzElIT vjufjMlLkWwhvIARBhsxNfuJ8EgINQEIEFPoOg1GXX+k6h5hyjLNTX8Aj2YtUJW4uU4o +owg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469539; x=1705074339; 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=e4mZu4dIothIAeIYl7XbtHN8Q7Ylsc498FBOxXuUI0M=; b=aPz5kVpuVYNX6Nup0OERi1vsR6Ar7XgXfTuvfiVTI57wi9465gEz+afLwE4rx5Hl/m RlxPH5CMS6g78FK0yErleZ5BPXmgmSyCWVW7423w56j//EBtg9JVFbv3n+iPQqdjSqls Ffkt/HQLnCDwwUjU5Pc5+xmm4VZYp8otb7D1AvBGq9xKjJlLh+8UKU7epKmYjI9xA+Zg pKGmzNtFJf9m+kYX7tN9UVIBNBaca6NfNSDW5OsgCLvWy2Yq7LeSBpDxMtJvd8NeaOWJ S6+pBAHU/f9+1BYy+Dsmiq+BangAF7us5EDRiVM7UkZR9O/Ibxx9VU5XwivI6/ma7/a6 nRXw== X-Gm-Message-State: AOJu0YxSNjzUH1TL+uZ4vCZ2963vUYYWTgNkeAB+d0OYWDsL1QG5e5Sm 1t2nv9s/2D6OacIcD4COWw5+NjZXsOKg60RxHiRzOp52HfI= X-Received: by 2002:a05:600c:5487:b0:40d:877d:ca1 with SMTP id iv7-20020a05600c548700b0040d877d0ca1mr1218741wmb.54.1704469539200; Fri, 05 Jan 2024 07:45:39 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id p11-20020a05600c468b00b0040d81ca11casm1930040wmo.28.2024.01.05.07.45.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:45:38 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell , Paolo Bonzini , Song Gao , Huacai Chen , Aurelien Jarno , Jiaxun Yang , Aleksandar Rikalo , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei Subject: [PULL 22/71] target: Use generic cpu_model_from_type() Date: Fri, 5 Jan 2024 16:42:15 +0100 Message-ID: <20240105154307.21385-23-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Use generic cpu_model_from_type() when the CPU model name needs to be extracted from the CPU type name. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231114235628.534334-23-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- target/arm/arm-qmp-cmds.c | 3 +-- target/i386/cpu.c | 3 +-- target/loongarch/loongarch-qmp-cmds.c | 3 +-- target/mips/sysemu/mips-qmp-cmds.c | 3 +-- target/ppc/cpu_init.c | 3 +-- target/ppc/ppc-qmp-cmds.c | 3 +-- target/riscv/cpu.c | 3 +-- target/riscv/riscv-qmp-cmds.c | 3 +-- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c index b53d5efe13..2250cd7ddf 100644 --- a/target/arm/arm-qmp-cmds.c +++ b/target/arm/arm-qmp-cmds.c @@ -237,8 +237,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data) typename = object_class_get_name(oc); info = g_malloc0(sizeof(*info)); - info->name = g_strndup(typename, - strlen(typename) - strlen("-" TYPE_ARM_CPU)); + info->name = cpu_model_from_type(typename); info->q_typename = g_strdup(typename); QAPI_LIST_PREPEND(*cpu_list, info); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index fd47ee7def..2524881ce2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1744,8 +1744,7 @@ static char *x86_cpu_class_get_model_name(X86CPUClass *cc) { const char *class_name = object_class_get_name(OBJECT_CLASS(cc)); assert(g_str_has_suffix(class_name, X86_CPU_TYPE_SUFFIX)); - return g_strndup(class_name, - strlen(class_name) - strlen(X86_CPU_TYPE_SUFFIX)); + return cpu_model_from_type(class_name); } typedef struct X86CPUVersionDefinition { diff --git a/target/loongarch/loongarch-qmp-cmds.c b/target/loongarch/loongarch-qmp-cmds.c index 645672ff59..ec33ce81f0 100644 --- a/target/loongarch/loongarch-qmp-cmds.c +++ b/target/loongarch/loongarch-qmp-cmds.c @@ -22,8 +22,7 @@ static void loongarch_cpu_add_definition(gpointer data, gpointer user_data) CpuDefinitionInfo *info = g_new0(CpuDefinitionInfo, 1); const char *typename = object_class_get_name(oc); - info->name = g_strndup(typename, - strlen(typename) - strlen("-" TYPE_LOONGARCH_CPU)); + info->name = cpu_model_from_type(typename); info->q_typename = g_strdup(typename); QAPI_LIST_PREPEND(*cpu_list, info); diff --git a/target/mips/sysemu/mips-qmp-cmds.c b/target/mips/sysemu/mips-qmp-cmds.c index 6db4626412..7340ac70ba 100644 --- a/target/mips/sysemu/mips-qmp-cmds.c +++ b/target/mips/sysemu/mips-qmp-cmds.c @@ -19,8 +19,7 @@ static void mips_cpu_add_definition(gpointer data, gpointer user_data) typename = object_class_get_name(oc); info = g_malloc0(sizeof(*info)); - info->name = g_strndup(typename, - strlen(typename) - strlen("-" TYPE_MIPS_CPU)); + info->name = cpu_model_from_type(typename); info->q_typename = g_strdup(typename); QAPI_LIST_PREPEND(*cpu_list, info); diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 40fe14a6c2..344196a8ce 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7036,8 +7036,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data) return; } - name = g_strndup(typename, - strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX)); + name = cpu_model_from_type(typename); qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr); for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { PowerPCCPUAlias *alias = &ppc_cpu_aliases[i]; diff --git a/target/ppc/ppc-qmp-cmds.c b/target/ppc/ppc-qmp-cmds.c index f9acc21056..c0c137d9d7 100644 --- a/target/ppc/ppc-qmp-cmds.c +++ b/target/ppc/ppc-qmp-cmds.c @@ -181,8 +181,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data) typename = object_class_get_name(oc); info = g_malloc0(sizeof(*info)); - info->name = g_strndup(typename, - strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX)); + info->name = cpu_model_from_type(typename); QAPI_LIST_PREPEND(*first, info); } diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 22d7422c89..b07a76ef6b 100644 --- a/target/riscv/cpu.c +++ b/target/riscv/cpu.c @@ -657,8 +657,7 @@ char *riscv_cpu_get_name(RISCVCPU *cpu) g_assert(g_str_has_suffix(typename, RISCV_CPU_TYPE_SUFFIX)); - return g_strndup(typename, - strlen(typename) - strlen(RISCV_CPU_TYPE_SUFFIX)); + return cpu_model_from_type(typename); } static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags) diff --git a/target/riscv/riscv-qmp-cmds.c b/target/riscv/riscv-qmp-cmds.c index 2f2dbae7c8..c5551d2cfe 100644 --- a/target/riscv/riscv-qmp-cmds.c +++ b/target/riscv/riscv-qmp-cmds.c @@ -44,8 +44,7 @@ static void riscv_cpu_add_definition(gpointer data, gpointer user_data) const char *typename = object_class_get_name(oc); ObjectClass *dyn_class; - info->name = g_strndup(typename, - strlen(typename) - strlen("-" TYPE_RISCV_CPU)); + info->name = cpu_model_from_type(typename); info->q_typename = g_strdup(typename); dyn_class = object_class_dynamic_cast(oc, TYPE_RISCV_DYNAMIC_CPU); From patchwork Fri Jan 5 15:42:16 2024 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: 760168 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105037wru; Fri, 5 Jan 2024 07:47:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqER0AK7b7ZrnsBnxBWlFV91LANu99sFQWFQKzDaadY3+hN34sOTVy79WVst+lBAZkP1+1 X-Received: by 2002:a05:6870:558d:b0:204:4437:57fc with SMTP id qj13-20020a056870558d00b00204443757fcmr2183802oac.54.1704469667151; Fri, 05 Jan 2024 07:47:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469667; cv=none; d=google.com; s=arc-20160816; b=GxhFhJZgv07EJ5hLVQR2J2iwJRt8BDMUlSHiqmlGowP0/9Yd9hcLgSCQXtmdU2nRHq u0R9/MllGllZsuWDR3hnjjXLMgTmH8TRyRHNPOKUeRK7BVsDa98FzIcOS8PKAyUvv/N8 qbhZQJiLS8cKZOJFT2G5rbV8gRlIq0U1h8M7gsvVyxs+JIATCiW2bCVmyEG819OXvjMY dMddVcEYW+dwwBSOEJW7pmw/PnK698h9oA5ZOBu04HLUt9zW2tQZQRKKZzKK7RCrn9WJ DpHFAEwAX2LjoU+aQIbruc9iKdLqFFK5Xryl8Y9S1hbmElyCzuO7MEW7+ACc2Z0U6yn7 mHqQ== 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=3jkeu47vffO/ERd6kLypsT3czQKlKT7aS4JG6Pky2DY=; fh=td9QpBWgYy8BIxWFOzE6sPVwtXswtNuSqozG5aJoYjk=; b=c1LzuJunlxpKF/TRY5Sp/1B/Qnl7vPKIJB4ZlN2IITWFr/HvrkpWeFLIODiu4D1sU1 M3zczObiSiYer5u2OOJ3B+plySCl4l0GNT+AVoPzAzDCcIxvLpJZjSHPMSaxw3DwQC0X IGVhWhf4N6fuSG9wbd0RF2VhW7osHv2GOPGvEGOXVC3Iie40FM0dLG2Pn0LpNUkxPNYL iZmTOsoZpgSYgyAehxvRZ2UwKwTH796/ml7ZuXILkFsO6ichlPhFuqAnCsWuL1v1JsJ8 slScFiaUMD/NAf+/uTwHZa4IL3I8r52LO10jR0fZMGAIZENkFMlnxHceOMpPSp7jy42f zYww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h9EycmOG; 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 t21-20020a05620a451500b00781cb2e8277si2037040qkp.133.2024.01.05.07.47.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47: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=h9EycmOG; 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 1rLmPJ-0003j0-Fz; Fri, 05 Jan 2024 10:46: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 1rLmOa-0001iO-P6 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:06 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmOU-0003mg-Tu for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:01 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3367632ce7bso1226428f8f.2 for ; Fri, 05 Jan 2024 07:45:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469549; x=1705074349; darn=nongnu.org; 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=3jkeu47vffO/ERd6kLypsT3czQKlKT7aS4JG6Pky2DY=; b=h9EycmOGdrNO5rvwWd01oYWHv05fzv3TQOZuWVJE4irUf8D6knzOusi9vZM65kRooH BEm9jur62/mXsreihLsy0Ttwdqcp6z8LIde3lXEc6xdDoz/dJhY32YF4Yx1slTjbfU/y XD3f1tVWwy3d+lsa3TQD0TtFURSS4fvcSiW6s6TvHWtpQfgghuaCSAoCYOmBNKht3aDc HbttmLSi7tlKkplwsxdxnnhu8F/YZ8CS08Tea+Pwx49ZGs9oHyd0WCxZVjeKYSuGPluZ eZS8RDARtOWdy8jD9QopSseYJuZWLC0lSd3ghyYrIZM1d0AYuvJTLPHdmMbO6/Sj246l NDdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469549; x=1705074349; 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=3jkeu47vffO/ERd6kLypsT3czQKlKT7aS4JG6Pky2DY=; b=mnWQtfd3l/bvBpKqBVhyLknSEAZPiqCju0tgYiqSuI12Xk5QMNE0TMRQARSgZEMZw+ oAWH+LXKsmVieIFog6Dj/rh+hTYQ8sI+JhBvIwT/vSf7vTjRQAPBqMqHPp8UF6CklAj5 wfxKID5wiasSXfhl/QMRYhmeuQxeEi/Lraaenxwt+SbFlqXbFafpRjRM1MACiWBpWYi9 RvrLJ9CFOB1Os/MBXyjTHOy1xJ9XN5+XspbeJTLoNG8dJIfNKI/2FlwTOnobb5b+Vh5/ uXOk/70PykpNsAyc+lztUomkBYWZNh9Ck38Apm3b40hO5ZrwH7n4MoQD3ve9KqQC9JnQ bGlg== X-Gm-Message-State: AOJu0Yy5m2FNcFjoy/RwZn9vaRL9cLL7I6ALsYH7Noz78XH3Lk4rwU5s vWZ3mbs5a88I3tCrkLta8Hl9KpsNcW5FUTC+Sqok4rs1z1A= X-Received: by 2002:a5d:5227:0:b0:337:5588:801f with SMTP id i7-20020a5d5227000000b003375588801fmr1201012wra.57.1704469549409; Fri, 05 Jan 2024 07:45:49 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id d7-20020adfe2c7000000b00336d24b4847sm1592885wrj.114.2024.01.05.07.45.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:45:49 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Paolo Bonzini Subject: [PULL 23/71] hw/core: Add machine_class_default_cpu_type() Date: Fri, 5 Jan 2024 16:42:16 +0100 Message-ID: <20240105154307.21385-24-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Add a helper to return a machine default CPU type. If this machine is restricted to a single CPU type, use it as default, obviously. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231116163726.28952-1-philmd@linaro.org> --- include/hw/boards.h | 6 ++++++ hw/core/machine.c | 8 ++++++++ system/vl.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 8af165f4dc..bcfde8a84d 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -24,6 +24,12 @@ OBJECT_DECLARE_TYPE(MachineState, MachineClass, MACHINE) extern MachineState *current_machine; +/** + * machine_class_default_cpu_type: Return the machine default CPU type. + * @mc: Machine class + */ +const char *machine_class_default_cpu_type(MachineClass *mc); + void machine_add_audiodev_property(MachineClass *mc); void machine_run_board_init(MachineState *machine, const char *mem_path, Error **errp); bool machine_usb(MachineState *machine); diff --git a/hw/core/machine.c b/hw/core/machine.c index 2699bcba53..0198b54b39 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1390,6 +1390,14 @@ out: return r; } +const char *machine_class_default_cpu_type(MachineClass *mc) +{ + if (mc->valid_cpu_types && !mc->valid_cpu_types[1]) { + /* Only a single CPU type allowed: use it as default. */ + return mc->valid_cpu_types[0]; + } + return mc->default_cpu_type; +} void machine_run_board_init(MachineState *machine, const char *mem_path, Error **errp) { diff --git a/system/vl.c b/system/vl.c index 6b87bfa32c..fbdf8bd55a 100644 --- a/system/vl.c +++ b/system/vl.c @@ -3737,7 +3737,7 @@ void qemu_init(int argc, char **argv) migration_object_init(); /* parse features once if machine provides default cpu_type */ - current_machine->cpu_type = machine_class->default_cpu_type; + current_machine->cpu_type = machine_class_default_cpu_type(machine_class); if (cpu_option) { current_machine->cpu_type = parse_cpu_option(cpu_option); } From patchwork Fri Jan 5 15:42:17 2024 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: 760164 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp104973wru; Fri, 5 Jan 2024 07:47:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSvD7PoiTKnGGBmiRzzFhKZMjH5Cl2vpBb6tAHHAh9UTt5jY0ZXzbaq1z/LYYgIdjC7mAW X-Received: by 2002:a05:622a:1a07:b0:428:409c:b261 with SMTP id f7-20020a05622a1a0700b00428409cb261mr2203820qtb.59.1704469655810; Fri, 05 Jan 2024 07:47:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469655; cv=none; d=google.com; s=arc-20160816; b=aS6Vgr7U/QJljp9c1H4yBPBBcVOozMDlx5lq8zUUue3ipgOJLcKVO+HXokuXFEy3QP rOSV2Yz2yR3tGLi4EVI1+YxtGLRf/ByLluxbwLq0YsckWrR65XDodkQXem2ScK9I41ur 1/9VYhKmYrC7A7qQEiptC7/zpM3Y00qsdVkK6ZLXqPlfpLe45BDoOdkNUk5zBLqb8ZfJ NDRYkMvLCXQxKjRbtXAbXvuAZQt/VYLZrBgMRMg1WaPIcuyJLN+eRuGZy+OZ5zypYG7M eDGaaT5OG5uVbgu0Cjm2B18Q/6FoiJA/AVgGccCECiXMNkQYK8JPGS92D8+N7MBAq0yD 8olw== 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=RbnewdzJw2WIotOB6UCheBhSeiFExHVz6pISXRX/KZs=; fh=wMeZfoc5ck+eRPBCDnHtP2JAFqkiP67xlh2SYgeCFeY=; b=XCAu5MyVt2eMAJbSmigKTsGmtXw0mncbIcloXo9iRt7rzkQCrX8b0yT4tR/KgqS4mX s3vJTNJuIxXjp2fZHGJO+pxUJjgXrdurV6JuMeQ4lL2WdmOO6QUxcEX7zsupkzAycqvh s/5IPGMxuLh5yo2vnDbU463/+fiUgVJamxy1mzCL3CDs0DcoaUdE4W3Qw1oz4kQ2Q7BN IQQ9UipJmJLp7+2VjCEtk7LmetZZqOXk0/TaF+TH9Pi8yujL7bDg5+f3vH8qdSmdVQOK zZh/zGiPzBwyiN4n+FTa9jJ7lxOfe0t/wPTMO9zeWfz46FT3mnkR5vTlZWDBO1xg0pAY 3V0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wWWcE4ZM; 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 f18-20020a05622a105200b0042577976e8dsi1992351qte.456.2024.01.05.07.47.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:47:35 -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=wWWcE4ZM; 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 1rLmPS-0004Ie-HZ; Fri, 05 Jan 2024 10:47:00 -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 1rLmOa-0001iK-Op for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:06 -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 1rLmOU-0003n6-VQ for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:02 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3367601a301so1315070f8f.2 for ; Fri, 05 Jan 2024 07:45:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469555; x=1705074355; darn=nongnu.org; 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=RbnewdzJw2WIotOB6UCheBhSeiFExHVz6pISXRX/KZs=; b=wWWcE4ZMz7jSyR8BERdVhQ5fdM5Uw0UJqJBGbybWADWqeHA/6Zm+NazIwCBvMKycrW jncj9/hpBZXlwyUFGSMy6Riz8Jlr+8I4QRNcBVY/fl1ayHL7O3BJwICGD/nMI7a5pOTV TKZUKgXS+nQOLv/KJYSeartncYUbmHpGjR2XXh3B8szDogVIK9k331Kbnpnm/Cya54HM D1tt9Lj8FKpEot1W9qouSfpYd3sKQ8oczIo2gxP42tjRz3qGiSsUXgAyFzRDJ8rd5zIW c32mAF3NyJGvxzgGXul4gxoMf3RT0LACVzMYeqWbD66cAiMttpncleQDzstsCyXOazHe 4cIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469555; x=1705074355; 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=RbnewdzJw2WIotOB6UCheBhSeiFExHVz6pISXRX/KZs=; b=xD0zJoG20bH/U8tA1sI84aCvCkIc4UIFvToW7lcItR1QigqHodkiZ1fXxlkCdBWSE5 cjs3hsTlVJivElOw+/A1+IdLjDIHSCT3QLoUzgA7z9WxqpM4zuVklY+b4CXdXj5oGZg1 wMWEY6b3bo6ti88vjS6yXRw5MbFRzW31tzpd0Gtfk5Z4PkxQDKniQtyJXgl/o55jaWKM XeLshw3hXUvGEWnylr3B2+mYyAqJZnaRut1S7UwaO7iM54eegR/nHPMh+zLaPlKTm1KY HmwAmV/Xi486V4g5LH3Ng01VYfmBVZpTGbPBR+Hic11fHqFNCat7rBL26KXAj4yD8qPl FHUg== X-Gm-Message-State: AOJu0YxHvUxoDbnGg8JtbPfO5ZEFu91UE3u1F57nSXgo3fe0RF9hsV35 uJIrL7K9v645q1zyWtOyk01LK4it3e+VYLebaOIu0kYzxrw= X-Received: by 2002:a5d:650c:0:b0:337:5280:a14 with SMTP id x12-20020a5d650c000000b0033752800a14mr856805wru.170.1704469555497; Fri, 05 Jan 2024 07:45:55 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id x17-20020a5d6511000000b0033743c2d17dsm1609158wru.28.2024.01.05.07.45.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:45:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Igor Mammedov , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 24/71] machine: Use error handling when CPU type is checked Date: Fri, 5 Jan 2024 16:42:17 +0100 Message-ID: <20240105154307.21385-25-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Functions that use an Error **errp parameter to return errors should not also report them to the user, because reporting is the caller's job. The principle is violated by machine_run_board_init() because it calls error_report(), error_printf(), and exit(1) when the machine doesn't support the requested CPU type. Clean this up by using error_setg() and error_append_hint() instead. No functional change, as the only caller passes &error_fatal. Suggested-by: Igor Mammedov Signed-off-by: Gavin Shan Reviewed-by: Markus Armbruster Message-ID: <20231204004726.483558-2-gshan@redhat.com> [PMD: Correct error_append_hint() argument] Signed-off-by: Philippe Mathieu-Daudé --- hw/core/machine.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 0198b54b39..1898d1d1d7 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1477,15 +1477,16 @@ void machine_run_board_init(MachineState *machine, const char *mem_path, Error * if (!machine_class->valid_cpu_types[i]) { /* The user specified CPU is not valid */ - error_report("Invalid CPU type: %s", machine->cpu_type); - error_printf("The valid types are: %s", - machine_class->valid_cpu_types[0]); + error_setg(errp, "Invalid CPU type: %s", machine->cpu_type); + error_append_hint(errp, "The valid types are: %s", + machine_class->valid_cpu_types[0]); for (i = 1; machine_class->valid_cpu_types[i]; i++) { - error_printf(", %s", machine_class->valid_cpu_types[i]); + error_append_hint(errp, ", %s", + machine_class->valid_cpu_types[i]); } - error_printf("\n"); - exit(1); + error_append_hint(errp, "\n"); + return; } } From patchwork Fri Jan 5 15:42:18 2024 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: 760175 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105603wru; Fri, 5 Jan 2024 07:49:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgTx9FxwsG0akgjBObTXlOpNnIbT0gqoDyXVB0La+l/4SiqDbNo2NRPKi6snT0VubHUt/B X-Received: by 2002:a37:ef0f:0:b0:781:6d22:6bf4 with SMTP id j15-20020a37ef0f000000b007816d226bf4mr2390345qkk.86.1704469739770; Fri, 05 Jan 2024 07:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469739; cv=none; d=google.com; s=arc-20160816; b=eLofGC2pwL/4C+EOjuYv0DMjEb/kbsW8kxFEA26Er/2GJsuyKfJZYbVH1EUGBhyIZA oLiwkQnHhHXhKFwHy7GqUQLV9HVL5kSaC5IXY99NJomkcCuIoFSjsDLfsYqnvEmf+9rX CHHLwvT61c1B+yw3tle2CfjCOAPVvA8LEO6WvhPCuCvslor05qbwGSi0Po1Zqso+Wvlw Ss5bJmVGp0IbJPHCHUOdHAcKCAeFb+n9m+4XEPobzLr0eubDsLGN+ESUFX4R/OZUYf7X SbpMpiYveeWpkkDKhFBjy3aKG+e5rwD0bHZvpasZIDU9LkrRQNWstpIIWwPr0+cTQRvk 23bg== 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=Z1uFhaGSAXCVtK5H8w3hTtFzEkQOw8kna05bCiblS/M=; fh=3nCCaiiW3tvaCvW7R3dnb3A1HVjFyaxnPEYthLbnaW4=; b=J2HCBreWLe+YAR0X17r6FY7gRNh7NvmY/ePov86sMPVJlZ7xrFPtl2QzjHHqK3HjJb PuYf0PTEg0p5xNb7v/dslWaQJgZhCpozvotsMzV+FMH6f8MdruUO7B7S6yx90FBGeUsN /NIMsxUhzd16DTm8qu0ZZwHaHhw2AT4d7uzRJ6drTSi7ljFBroiPsIv6FIdjIyCKptGj 7k8LfV0mdO1D0zZxdBKAsnuKVWPDbBe5vpg5/NT7LxTZ6aqFZbIigTLW3HKYrP/imthr GF+r7g8voGNQMdq43NeiW+CS1AWcESND0X9TEd0M83ONyCOqaf53R05ELR3i/CFONrPy LgqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f+PT+rUv; 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 o19-20020a05620a2a1300b007815e617d6asi2046273qkp.300.2024.01.05.07.48.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:48:59 -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=f+PT+rUv; 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 1rLmPd-0004i5-9y; Fri, 05 Jan 2024 10:47:09 -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 1rLmOh-0001qc-9s for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:12 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmOa-0003o3-VF for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:11 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40d3352b525so16183265e9.1 for ; Fri, 05 Jan 2024 07:46:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469561; x=1705074361; darn=nongnu.org; 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=Z1uFhaGSAXCVtK5H8w3hTtFzEkQOw8kna05bCiblS/M=; b=f+PT+rUvYR9fqDBm8gjVu32P9inyKy7hXUYxxSF8Nm5iMU6IIL/QaayarcXkX86jN0 ddqtdXG29N9ymQdvb/Q4DIkDf7qtkmW5KtkNRv8wBMVR/dqD8yCg8HuVmZiooWz8kYW+ T4EVbq3y1P8OdhUnDoWCgionN9RQoFVQ/lxWP14p5UwHRKDzgO4AT9HWSOip9AeOXb7g MwAZsFozCxcCk0Qf/kqrZ07wOE7Kyy6RyBgfXUaqTyzdQkv8dVOpjegVm8iHvXDVuRNp 3AL5ocMUl6zbxkiD/5bqwyJXiLtsffKsBzSFPyoPVcYbZeMBYduoLC7oF93QCrbRwaWg F1TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469561; x=1705074361; 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=Z1uFhaGSAXCVtK5H8w3hTtFzEkQOw8kna05bCiblS/M=; b=iE3TpbrS9g8FgKI32rop5BZrQVEyCMieh3jDo1mZpAJy3aQlNHjplcVV8YGskPPYIX zCOGNIeMGACBnQpbEWEMancefvpTbFVataGRuNAzB23ReGqKSpOhjui08A/8RVF37zvQ EurPL+fIiKtyq8T5CBAlEAWSO3wx+m8m95PxHQpEi5v/Rb65oVeiOUW7FsLTCPOlPQQu S0f0pYO9EMVciArSD1QK9GMhrH9PBXK4pXnwQtbeIVdG+HY/WPSnc3+NFZN6Uw11E03M 6Dc1xuNkF5lBNq15Ykb6jIViuvWlmd646XrROZBIuYIY/fkNFGAdxh1ddCPih5A+HFGh BcdQ== X-Gm-Message-State: AOJu0YzGs24T5DA+x2nK1RLLVWdmtDaezcNk3OhnJh1o4K9sjxuBvnwd 9IuTxPheSDXRd2nrQbB6BKGJigwwSC04IC89SIZuhpUX/zk= X-Received: by 2002:a05:600c:3b95:b0:40e:3532:2f6f with SMTP id n21-20020a05600c3b9500b0040e35322f6fmr1208080wms.182.1704469560809; Fri, 05 Jan 2024 07:46:00 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id f13-20020a05600c154d00b0040e3635ca65sm1945854wmg.2.2024.01.05.07.45.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 25/71] machine: Introduce helper is_cpu_type_supported() Date: Fri, 5 Jan 2024 16:42:18 +0100 Message-ID: <20240105154307.21385-26-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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 From: Gavin Shan The logic, to check if the specified CPU type is supported in machine_run_board_init(), is independent enough. Factor it out into helper is_cpu_type_supported(). machine_run_board_init() looks a bit clean with this. Since we're here, @machine_class is renamed to @mc to avoid multiple line spanning of code. The comments are tweaked a bit either. No functional change intended. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231204004726.483558-3-gshan@redhat.com> [PMD: Only call new helper if machine->cpu_type is not NULL] Signed-off-by: Philippe Mathieu-Daudé --- hw/core/machine.c | 84 ++++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 1898d1d1d7..0119b11fc8 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1399,12 +1399,53 @@ const char *machine_class_default_cpu_type(MachineClass *mc) return mc->default_cpu_type; } +static bool is_cpu_type_supported(const MachineState *machine, Error **errp) +{ + MachineClass *mc = MACHINE_GET_CLASS(machine); + ObjectClass *oc = object_class_by_name(machine->cpu_type); + CPUClass *cc; + int i; + + /* + * Check if the user specified CPU type is supported when the valid + * CPU types have been determined. Note that the user specified CPU + * type is provided through '-cpu' option. + */ + if (mc->valid_cpu_types) { + for (i = 0; mc->valid_cpu_types[i]; i++) { + if (object_class_dynamic_cast(oc, mc->valid_cpu_types[i])) { + break; + } + } + + /* The user specified CPU type isn't valid */ + if (!mc->valid_cpu_types[i]) { + error_setg(errp, "Invalid CPU type: %s", machine->cpu_type); + error_append_hint(errp, "The valid types are: %s", + mc->valid_cpu_types[0]); + for (i = 1; mc->valid_cpu_types[i]; i++) { + error_append_hint(errp, ", %s", mc->valid_cpu_types[i]); + } + + error_append_hint(errp, "\n"); + return false; + } + } + + /* Check if CPU type is deprecated and warn if so */ + cc = CPU_CLASS(oc); + if (cc && cc->deprecation_note) { + warn_report("CPU model %s is deprecated -- %s", + machine->cpu_type, cc->deprecation_note); + } + + return true; +} + void machine_run_board_init(MachineState *machine, const char *mem_path, Error **errp) { ERRP_GUARD(); MachineClass *machine_class = MACHINE_GET_CLASS(machine); - ObjectClass *oc = object_class_by_name(machine->cpu_type); - CPUClass *cc; /* This checkpoint is required by replay to separate prior clock reading from the other reads, because timer polling functions query @@ -1459,42 +1500,9 @@ void machine_run_board_init(MachineState *machine, const char *mem_path, Error * machine->ram = machine_consume_memdev(machine, machine->memdev); } - /* If the machine supports the valid_cpu_types check and the user - * specified a CPU with -cpu check here that the user CPU is supported. - */ - if (machine_class->valid_cpu_types && machine->cpu_type) { - int i; - - for (i = 0; machine_class->valid_cpu_types[i]; i++) { - if (object_class_dynamic_cast(oc, - machine_class->valid_cpu_types[i])) { - /* The user specified CPU is in the valid field, we are - * good to go. - */ - break; - } - } - - if (!machine_class->valid_cpu_types[i]) { - /* The user specified CPU is not valid */ - error_setg(errp, "Invalid CPU type: %s", machine->cpu_type); - error_append_hint(errp, "The valid types are: %s", - machine_class->valid_cpu_types[0]); - for (i = 1; machine_class->valid_cpu_types[i]; i++) { - error_append_hint(errp, ", %s", - machine_class->valid_cpu_types[i]); - } - - error_append_hint(errp, "\n"); - return; - } - } - - /* Check if CPU type is deprecated and warn if so */ - cc = CPU_CLASS(oc); - if (cc && cc->deprecation_note) { - warn_report("CPU model %s is deprecated -- %s", machine->cpu_type, - cc->deprecation_note); + /* Check if the CPU type is supported */ + if (machine->cpu_type && !is_cpu_type_supported(machine, errp)) { + return; } if (machine->cgs) { From patchwork Fri Jan 5 15:42:19 2024 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: 760214 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109077wru; Fri, 5 Jan 2024 07:57:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHAkPfdF+Wi1Yvm3Hs+/IZH4ZcBc8hOoj2zlMO5ZbLWze1tk8jx3w5rHho/sNdhZbR9mnb X-Received: by 2002:a05:6808:3094:b0:3bc:3c5b:574 with SMTP id bl20-20020a056808309400b003bc3c5b0574mr334696oib.33.1704470231700; Fri, 05 Jan 2024 07:57:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470231; cv=none; d=google.com; s=arc-20160816; b=ovgUEBTAKOQTvwT30SBQiWORj4hEQQDSyBjxEhhZhjVl1Km0+vo1m2uMTgv5tueT8z iLLcuk0LjM55AJ7P6CDpqT6in6bPtmjIMzOolJ/fIAFbeOXSqO1zKl8q+VrZa5cQDEmc Mj67q3Xf4aIThjCI3//LcgH67yynsuvYT9EKv8iOcY+JbL/obq84o1d53bvxfM+/dCvl HOejw4xvKWA2llBAB3bb/+aqQIC7F8rdh7J+KdaYBcjPXg53DxiSTQIvxoCfNghlDuas sgJFeB1ALifBiNsp+5RLoPf3myltD9hUDj9cCFMvOfOr23vs6pmxhrUIFsBLk4j0lxCv wiew== 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=1OMJ2J/9TeJEsVbvbtgjbGV5MuipQ2Dh2Ow8E2AaclY=; fh=3nCCaiiW3tvaCvW7R3dnb3A1HVjFyaxnPEYthLbnaW4=; b=cAP6Cnnuv9zNNy3M/HRcqNHoNdC3tzD6z5XvVNWuudmAGx5li+cGLjE2PP5ad25Iel Ht2kFfHag8qiNTA33R9+Xx3Z4D9/ndcQoRmZPx8vfHtXbMl4W6wz7H0A+QQWVVSBhRkp OYDSR9/ZyIpqUZS1LfeIMzVCFCM3EeiJy9d1tCvJDo13kXFKnj/n/lqpLrRTltiojfS4 dy/mzDiy4xHkafueCHrHc/fb/S4aHEfg0jQjPSH0TVC6AiZSjfGQz6eVfhe3OGy9deIi IB+zuFrz9K09mRRsofe15lp5RDpV3Zhw+siJSjwU5o0n2RVSx9CspIkZX6B5NFKiyk8o itaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q1SsD5VV; 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-20020a0cab48000000b0067f9f601f8csi1953941qvb.326.2024.01.05.07.57.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:57:11 -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=Q1SsD5VV; 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 1rLmPe-0004qI-BN; Fri, 05 Jan 2024 10:47:11 -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 1rLmOj-0001wJ-3V for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:14 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmOe-0003pA-RC for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:12 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40d5336986cso18963555e9.1 for ; Fri, 05 Jan 2024 07:46:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469566; x=1705074366; darn=nongnu.org; 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=1OMJ2J/9TeJEsVbvbtgjbGV5MuipQ2Dh2Ow8E2AaclY=; b=Q1SsD5VVAHJmO+jOod0cqpLhrRuuvNV3fyxFAkIeyZmyfL74xygwDD/J1dpm8oLjbR msuNkNT5Yt2vB5CLgIU7YjX8GB91mEJogAFOZb44BtDKX/SRjjcrdB26exdEO0W4OfAR KuB1wZiNSrsRSbCQK0Vzd0SIZDiV2PLs5MQs6Nh4V3AQFC5++K3GXJ9Brar7sPdTaN+U stc5Mh8+zCwkmKMfdUup+UJfGKDYAHDCXuys27hYGnVsFDmwOcIPsm0wsZ8Cr7hw9kKu OvFfPOl4SV0J9udBgy9HB+hqsKuulC55LBe4CMSGy2yCYh1GSyuGqc/xWK81Del+p9Ag AOww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469566; x=1705074366; 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=1OMJ2J/9TeJEsVbvbtgjbGV5MuipQ2Dh2Ow8E2AaclY=; b=FBtPXNa5GSQqxAEpHv8wPVJSlb11eHPoX7xnl5o/OffYzP7koX6Z1wfsEhZ7q6GzzJ PoRvNc/+L8YZZu56Awrs970RwiJ4rBaveKgHPQv+blkC2jx9EJdgOh+30+AdcrhmHHNT r0v9k5ah91yBWqdvzwMu6hQtsNRHjTYl/tLW8YQbVrNlC29vO4BBHCf4vY5pg52jCkca rPerOf5Iod8OzYlW64PqfscvNoKZhMLRnkLuZaAd4aUvIJ0tuZrNG4kxxe82ylsxo2Gu ndYUDNbBAn1/z8oO5HPBukNzVxERhaZ/GzDHoJJ3CJ/CzF/tQyc/Xjrho/F3blWNRbAt 4RMg== X-Gm-Message-State: AOJu0YwY2z+s2/lMGc+/MojJPEu1L9zP8iOPoLUvE2/AaQ9mhxvO5zuH TiAVGpuvzTGRiwABnPDjzUdp8jD9cuwBa6j334OFjrmanRg= X-Received: by 2002:a05:600c:1d82:b0:40e:36ba:e51a with SMTP id p2-20020a05600c1d8200b0040e36bae51amr729802wms.132.1704469566494; Fri, 05 Jan 2024 07:46:06 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id p15-20020a05600c358f00b0040d90407f7esm1931456wmq.8.2024.01.05.07.46.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 26/71] machine: Improve is_cpu_type_supported() Date: Fri, 5 Jan 2024 16:42:19 +0100 Message-ID: <20240105154307.21385-27-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan It's no sense to check the CPU type when mc->valid_cpu_types[0] is NULL, which is a program error. Raise an assert on this. A precise hint for the error message is given when mc->valid_cpu_types[0] is the only valid entry. Besides, enumeration on mc->valid_cpu_types[0] when we have mutiple valid entries there is avoided to increase the code readability, as suggested by Philippe Mathieu-Daudé. Besides, @cc comes from machine->cpu_type or mc->default_cpu_type. For the later case, it can be NULL and it's also a program error. We should use assert() in this case. Signed-off-by: Gavin Shan Message-ID: <20231204004726.483558-4-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/core/machine.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 0119b11fc8..c523ce32eb 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1412,6 +1412,7 @@ static bool is_cpu_type_supported(const MachineState *machine, Error **errp) * type is provided through '-cpu' option. */ if (mc->valid_cpu_types) { + assert(mc->valid_cpu_types[0] != NULL); for (i = 0; mc->valid_cpu_types[i]; i++) { if (object_class_dynamic_cast(oc, mc->valid_cpu_types[i])) { break; @@ -1421,20 +1422,27 @@ static bool is_cpu_type_supported(const MachineState *machine, Error **errp) /* The user specified CPU type isn't valid */ if (!mc->valid_cpu_types[i]) { error_setg(errp, "Invalid CPU type: %s", machine->cpu_type); - error_append_hint(errp, "The valid types are: %s", - mc->valid_cpu_types[0]); - for (i = 1; mc->valid_cpu_types[i]; i++) { - error_append_hint(errp, ", %s", mc->valid_cpu_types[i]); + if (!mc->valid_cpu_types[1]) { + error_append_hint(errp, "The only valid type is: %s\n", + mc->valid_cpu_types[0]); + } else { + error_append_hint(errp, "The valid types are: "); + for (i = 0; mc->valid_cpu_types[i]; i++) { + error_append_hint(errp, "%s%s", + mc->valid_cpu_types[i], + mc->valid_cpu_types[i + 1] ? ", " : ""); + } + error_append_hint(errp, "\n"); } - error_append_hint(errp, "\n"); return false; } } /* Check if CPU type is deprecated and warn if so */ cc = CPU_CLASS(oc); - if (cc && cc->deprecation_note) { + assert(cc != NULL); + if (cc->deprecation_note) { warn_report("CPU model %s is deprecated -- %s", machine->cpu_type, cc->deprecation_note); } From patchwork Fri Jan 5 15:42:20 2024 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: 760197 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107557wru; Fri, 5 Jan 2024 07:53:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbTl/Bh804dDvYx/MKk5zg3l/XGmvYN8wwqpAf3d2JiFO7F1gKgKzzfH5ejlum6zdIaRLo X-Received: by 2002:ac8:7c44:0:b0:429:7d11:e053 with SMTP id o4-20020ac87c44000000b004297d11e053mr778562qtv.20.1704470005050; Fri, 05 Jan 2024 07:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470005; cv=none; d=google.com; s=arc-20160816; b=0uq+SNTDXciu8bKxVs87LZ5FORiGqmMAVkkwbnP401Q+1oZnKOvoZETPzw5hP6gm2h +Z7knU3Z21O5VJMEtGODBwGhar5TW5r8zA5yeKPf5s+7wygbTUPxFMM3ZKyGoJIzpm/9 YC+sYiOAIVLdPx5ncEMPEQI4OHdN6TdUVoYC/seoMikWvBlwZ+B1+FmQ2SKkBt8d8gPr fc1kOqeBrm0pWSpVv4mg0XqR7man30FLmnQ6X/ie94qa7daR3O6qW7g53Y0h1/o04buu Hqk+9TxUovhhskEtnCGhmeoCCcxaetRtmlj20Hv1Hk/UBCrze4+KnDoci7aqhvheY0d1 8qpQ== 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=TaWEpr5f/U/wZNl7ClicoZnkchpUab2rsBaBsce3JqA=; fh=3nCCaiiW3tvaCvW7R3dnb3A1HVjFyaxnPEYthLbnaW4=; b=oXRJG1zJVdbEBwjHbncQcF5FgxGJ5JKIAG5NuI7u0VVT+YSGxxz13QsTqFARJqwXai ArpIjgLUJMPC1lADGT8ABXJResNJPYiHXjA3fHZGg8oGPcEDbvTT+qiGkw9oEpfR7a7y BVtjfuNKJmuF6UJY1jaPw5NR5q/3u4dp5JPvtHvIZRnwBMZMTyq/yP5wQiz9eiYmJ26O iDikzhc6rosA6EWg/0aFRHHqBfyMyluMbs/yV6sfQuuEzg8eqkXZ4QROS7T0lxFyOAWT VYmWotezUiFVUdK4r+MRY70cQTzczW8AXIKObjcTK8E5lQ4Jbtr0+/UOW635GH9M6RRQ 8MNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ILKT0InO; 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 d17-20020a05622a101100b0042803178a9dsi2025667qte.188.2024.01.05.07.53.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53:25 -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=ILKT0InO; 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 1rLmPg-000581-V1; Fri, 05 Jan 2024 10:47:15 -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 1rLmOm-000204-QK for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:25 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmOj-0003qM-D4 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:16 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40d4f5d902dso16146425e9.2 for ; Fri, 05 Jan 2024 07:46:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469572; x=1705074372; darn=nongnu.org; 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=TaWEpr5f/U/wZNl7ClicoZnkchpUab2rsBaBsce3JqA=; b=ILKT0InOW9Wh0TE9nnBj+WiviH/WaLZ2lala2LTM3Aovv0TCxl0Pbwsc9kFU21n0b9 1DerARmCTs0ZNtAjGFfFlADSzSrWqBtdT6c9OexpGORqpgTGKiQNneNccpIuTSkvuVZB KblNMxRPeXNDg8ICd5uQ0ErMktTa9w/pq+f3jAKVX9Lm6tqPTV8f5bFBW0wf9himunrL ykMetXUvmr1a3RXbLacRdY3kjsrVVVT3RWv61tAUS4HoEu+kGsd6HSiup7Df9XZOy+8D CBcAwY2UHg1DBoGyKfZi4IIGiL+7BQuOmcT36oKycCdiqNVOKEpVv4U2tglj2CqkVMAT ED9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469572; x=1705074372; 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=TaWEpr5f/U/wZNl7ClicoZnkchpUab2rsBaBsce3JqA=; b=bjk89RuKEXhwB+Asie2e5wH9KzpAd9ED+4PEC0w/osYf9lxtxdNTVxJpTrKp6KweNt F8ZtvE8yesQ6Pt+OY7vjPg7GP8hOiIjqrroPhYJwwxsgDctLCKL4taF2YkN9KvA9S7L3 ApgbkSso9tynJuWEUn2sKgjxhpm2+fJ/OuqaWAzdSSy0ze4XRi2T0ayN/ATnhJDCyafV WNGnamsWRvzuIKsQrCjbl9cYGPP1RXjhhcuzyZYlMwjfxWFJrPWM92zv3Og4WU+cBfYZ rPc0wjyGDp9pyUleTuLcydHyxxpWzz+5YoKR8atPsoca6blgabjgHOI/pwjbcXP7QZaz dFmA== X-Gm-Message-State: AOJu0YxfiFnYXOQBrpcEja0AWM3sDd+ic8AdyIUWlU3tOBoaUN6DQSGx zDVzR3SbgPi4XE7wtLwyJ3xFxuDh+2ZLXuU8m+KKg0O7mBw= X-Received: by 2002:a05:600c:138e:b0:40d:9485:cc89 with SMTP id u14-20020a05600c138e00b0040d9485cc89mr1204952wmf.74.1704469571776; Fri, 05 Jan 2024 07:46:11 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id k9-20020a05600c1c8900b0040e3a1f88f2sm1376690wms.15.2024.01.05.07.46.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 27/71] machine: Print CPU model name instead of CPU type Date: Fri, 5 Jan 2024 16:42:20 +0100 Message-ID: <20240105154307.21385-28-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Gavin Shan The names of supported CPU models instead of CPU types should be printed when the user specified CPU type isn't supported, to be consistent with the output from '-cpu ?'. Correct the error messages to print CPU model names instead of CPU type names. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231204004726.483558-5-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/core/machine.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index c523ce32eb..fc239101f9 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1421,15 +1421,19 @@ static bool is_cpu_type_supported(const MachineState *machine, Error **errp) /* The user specified CPU type isn't valid */ if (!mc->valid_cpu_types[i]) { - error_setg(errp, "Invalid CPU type: %s", machine->cpu_type); + g_autofree char *requested = cpu_model_from_type(machine->cpu_type); + error_setg(errp, "Invalid CPU model: %s", requested); if (!mc->valid_cpu_types[1]) { - error_append_hint(errp, "The only valid type is: %s\n", - mc->valid_cpu_types[0]); + g_autofree char *model = cpu_model_from_type( + mc->valid_cpu_types[0]); + error_append_hint(errp, "The only valid type is: %s\n", model); } else { - error_append_hint(errp, "The valid types are: "); + error_append_hint(errp, "The valid models are: "); for (i = 0; mc->valid_cpu_types[i]; i++) { + g_autofree char *model = cpu_model_from_type( + mc->valid_cpu_types[i]); error_append_hint(errp, "%s%s", - mc->valid_cpu_types[i], + model, mc->valid_cpu_types[i + 1] ? ", " : ""); } error_append_hint(errp, "\n"); From patchwork Fri Jan 5 15:42:21 2024 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: 760182 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106158wru; Fri, 5 Jan 2024 07:50:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDhsYgAGJVgUO9zfd6QaTW4U2Qb7uONP3eKmPqGVzKev90U0UHMkf66372TaT2rnxl/a7e X-Received: by 2002:a05:6214:e48:b0:680:7a95:5715 with SMTP id o8-20020a0562140e4800b006807a955715mr2516174qvc.21.1704469813554; Fri, 05 Jan 2024 07:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469813; cv=none; d=google.com; s=arc-20160816; b=YaW3E+dHjBfDwfmFE0uUxnDyhf2Pmkl2rIME7CEyk/n4QB5iNZ2YDZ0XaToK4DbNRC FUl/j0MFkdLJRASKVSIlMzdF4lyt/TrwE+irSuxDD9sFiWAWUjSrpC36zgjEyydzrxUz 2lL0OboQ8xEuj3N/zMdzPBf3E6t90jnpeU58BlnoXPBk3sh8W8q4UhiplcaQ+7sPbKr4 AKZLoV7ltzvWjKnuy1x/Z5kKlwk2Q2OREu8D90RbXoPYjFaoKCeoq8+MqqXZElTyptlV hAPTV6Y3m6rL2T+TOo+7C9chD1S1o2iuHKjSsYijIcXnIi6Y7QzjxIdcDWY/9CJhI/Ux Z7fA== 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=SzfKYNH1/2wbsF3ubLhxzVujUnJw+6X9RP1nI43IQ80=; fh=PgmdcApeveQDElskOCknLWjCsqveGE+4rfVMPzrMCbA=; b=lQ/zck8h5VgA9WW4av6suquK+xEbsYS7g/3lRSycFgUrK4tYDd1ydx1mhc/9vDEERT EtsZBhjd4snP29KwJIF2rsOwvXkMWJB4rFUcQWyJpOtyUE8YIYZ4Zd63+X+pddseO9UO vFQNiRDJTlvlFKzTyNdDtzvTjxngIVEEXyxPn+DwLoObGj0h1epkPk0s5vHq+HWYDqpP m/bk8QXLpHhuhVbK4nR/9U53E5aglU6DNdHbbdtcOh68hM+b4iU3w4JrgZKJNljWPlb6 A1aZg+FsSGATVF7VFOnYbEetTnlj9bPFo92iRZGnt578zAxwzvknQLvIRd12V8uj5X9V ojsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ER+J0fYi; 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 v11-20020a0ce1cb000000b0067f87fc5e9bsi2001233qvl.136.2024.01.05.07.50.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:50:13 -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=ER+J0fYi; 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 1rLmQ0-0006Ec-8G; Fri, 05 Jan 2024 10:47:33 -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 1rLmP6-0002D6-MQ for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:37 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmOo-0003t8-Ky for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:24 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3373a30af67so1322941f8f.0 for ; Fri, 05 Jan 2024 07:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469577; x=1705074377; darn=nongnu.org; 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=SzfKYNH1/2wbsF3ubLhxzVujUnJw+6X9RP1nI43IQ80=; b=ER+J0fYiSRL3gi+24IzzqLi/vohO2TpKTOVS8ZxzSZqC9Ai0Lvseqm8dV9Kb08KJcp dYjRgEm1GVRhyi4n6XMmL8INkuwKezBuUIawlv4TubUjXFsSTgJ/DFg4WcnSeoboAMTK S+yc4RVCPE4zI4/4tydWnrUyfNWbDUt/gsyoeG+sgYjCylUll4xy5ogWnaE8+jJqNMqc nO3UhJexhrOY0FIBb7wXYBO9DaweNrAaVyYzMJ1Bw9HqfBJPSMyE+sMjpLVaFTLmVLbx UO/vG7esM3RKdCkk8QRV1KJNRnx9iuIHWcXVWE4cTzyTo1xIqwepADnoYvsOZTHPxjq1 F79w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469577; x=1705074377; 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=SzfKYNH1/2wbsF3ubLhxzVujUnJw+6X9RP1nI43IQ80=; b=AUiW8IKyrCJrxJIqs5KSaYSggJkGqliOHk3II4wN7wgtFlQeuwjqZOLlLKa1gkGfwt 3dmv/SOFWrn9DE0IsvQc2U9yzd53iw/34FM3oTRBO0l/Dq8FENX77qvdfqauilzFt387 A+FAhFna2XFSf5RdYYQOiki35DdF9RougBwGVybb4broRDG9DLxnhoJ677jPrAWbcT9E bXUrllQ90+J5FGcQBnnKzBcaVpPKBH5vLo+pehVUQJV9rgW4oJbe6rcSrTbqFhZealBp gj269pgLEmIGBiFVToqlEOPstPVNzpP2hUgxFsWRuZLLBIh0NnskAPcVhjpMkY8R3qOG IztQ== X-Gm-Message-State: AOJu0YxxsDirRU+eoDMmsS7h7ykdHCLVgJdt71lAKrPX1NnNihX7MYHO WtlXK2hNNaX+f0e8Tq6Xt2cMda5J4XXiwTlHh4qPwSEmRIo= X-Received: by 2002:adf:f552:0:b0:336:b9b3:f554 with SMTP id j18-20020adff552000000b00336b9b3f554mr797130wrp.133.1704469577055; Fri, 05 Jan 2024 07:46:17 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id y10-20020a5d620a000000b003372befd19bsm1607838wru.104.2024.01.05.07.46.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:16 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Peter Maydell Subject: [PULL 28/71] hw/arm/virt: Hide host CPU model for tcg Date: Fri, 5 Jan 2024 16:42:21 +0100 Message-ID: <20240105154307.21385-29-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan The 'host' CPU model isn't available until KVM or HVF is enabled. For example, the following error messages are seen when the guest is started with option '-cpu cortex-a8' on tcg after the next commit is applied to check the CPU type in machine_run_board_init(). ERROR:../hw/core/machine.c:1423:is_cpu_type_supported: \ assertion failed: (model != NULL) Bail out! ERROR:../hw/core/machine.c:1423:is_cpu_type_supported: \ assertion failed: (model != NULL) Aborted (core dumped) Hide 'host' CPU model until KVM or HVF is enabled. With this applied, the valid CPU models can be shown. qemu-system-aarch64: Invalid CPU type: cortex-a8 The valid types are: cortex-a7, cortex-a15, cortex-a35, \ cortex-a55, cortex-a72, cortex-a76, cortex-a710, a64fx, \ neoverse-n1, neoverse-v1, neoverse-n2, cortex-a53, \ cortex-a57, max Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231204004726.483558-6-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/virt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8b69aba189..8b060ef1d9 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -220,7 +220,9 @@ static const char *valid_cpus[] = { #endif ARM_CPU_TYPE_NAME("cortex-a53"), ARM_CPU_TYPE_NAME("cortex-a57"), +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) ARM_CPU_TYPE_NAME("host"), +#endif ARM_CPU_TYPE_NAME("max"), }; From patchwork Fri Jan 5 15:42:22 2024 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: 760176 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105621wru; Fri, 5 Jan 2024 07:49:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmgEa9Ca1lmkjFdeseEMCXQz4UBmtSV+5zaES1MRwYkPZN2b++aHI505M/AFepJIimRrvy X-Received: by 2002:a05:6214:2b0f:b0:679:f25a:8ff0 with SMTP id jx15-20020a0562142b0f00b00679f25a8ff0mr2418660qvb.26.1704469742013; Fri, 05 Jan 2024 07:49:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469742; cv=none; d=google.com; s=arc-20160816; b=TyD8qrbSAg8/n0lRcwiOL9MhYFPTwoTDZJBOOZ2aUFeMw7Mi3a1B+RCgTeg84fnlZV CtiWqu7MqtT/i5TivBXpCgofBXX9PoubHsBQKRA+m2sW3pfq/fwZ1SZVH4WSqGHoweed qjRGB8aLy7jxjqSK0XWV44Y4/aOMycaMNZwMHqUw82fsm5DhUW/XyjsdNbembrZbrwm2 uha8gsU5A85TfDalSfGwHoDRIm0jduDa23auGyYHJMzvppSZFK8uM+UBoT/qJAZRx+oH Ajg5RCenIreqPfOE46TygsYhFFxRW0+suZCjYioXywjS9EMW9PfCUrVh2BwmzLl+9tNA 6rCA== 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=+mHMa1tnUIKC/Lz8fv92EG3G72QPfm2OOOA3/xxqo/c=; fh=DAPvSgCUhAarA6fZ2xgq43lJ/6n+8M24aoksosCsGI8=; b=hwJgee7OTZyvuswtgct/iVmZWiAtVpdAD4WaF5jqQZxkImK2jtai7bBPFXzb0PX/nd QDcwfD/GZ/r/1exzzZAjiTQsaoPRUYto95Lh5Slyzt6PCS0fNNJ7xcr7Od3cuMHP08ya l+d3qt48Wpm4KpBAm6lyIbvUNNiqvw9dyguMJCDr1kAYr0mG5HsMco++IhALB/YHHLzD ApLTgXSKz96+dq/DcxBkHLfFWLsMEOEzVV7Nz9Mm2PGmcyookyYZY+PJw+EBX6w256UE bVTRhIRxbFiBJip7CeGG3YTfHmHxUIpgw33kjF9XQiPcLcyNQwLcySr9oZLuU3QIb8+R 36Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EOwq83hE; 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 bj2-20020a05620a190200b007830c5ba782si922332qkb.349.2024.01.05.07.49.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:49:01 -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=EOwq83hE; 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 1rLmQC-0007Dg-Qy; Fri, 05 Jan 2024 10:47: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 1rLmPM-0004Gs-W9 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:54 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmP7-0003ty-EX for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:52 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40e384404e7so8453145e9.1 for ; Fri, 05 Jan 2024 07:46:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469583; x=1705074383; darn=nongnu.org; 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=+mHMa1tnUIKC/Lz8fv92EG3G72QPfm2OOOA3/xxqo/c=; b=EOwq83hELeFzXU3fhCBRM97RIkwnmLILDORrxh2bmW24QwPbULqfd7wsz4Es911bwh HdII4/a4ZCwGC9VW56p7W5feklrHxYBna9uTCe341/xVNowZ3avbynacCH77WfUYR60Q ZaCY7UxQ0WGLEy21tWmX2eT5T4Bt9zYXj6+laWTuPUCNhZltkj+yMEISf/d/v34VhwmL jrjUG82zcNtDpGldhTm23oAuh7i7AeYLKoliImOelsmRmqE5Z16AFCj38dkmVkW0cMrS 09eE1C8LkROMEyAI9rH2h+M0wvhTU1MsRRi/MgI1y9Vc2S8tCnYcpDib6p846AWgd+84 B3Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469583; x=1705074383; 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=+mHMa1tnUIKC/Lz8fv92EG3G72QPfm2OOOA3/xxqo/c=; b=ZCbsg+ndCigijr6MuBpEbUPXbvjrHzmJdfWmW/s4V0gVkVrahZUvtXT1IbWeShMgJU ZkIkHFXXkUH8LjtR8kQkL58K2iOxCpwPCuRPuQdmumQzThb9bgKMd2wQQuROtZPTebdj 5S6Qo1xN6DYkWLeNcv565IJP0lDBJwxyObsKlQK/wT9vkLdZm2goMZZ6P6KkcxtbNsT8 RAVYubP7LIkvTvvA8xCsXuVo2Z/qyfletLEc0G0icTWPVoFZkAAUS40nqsO77E6wVSxb jY8ZQ5j0FWnBzkPIq6QH3HsThwHXHjw1QfNzVy/DtNU0CxO7HYduc3a60nm0+An8nMcs 6dTQ== X-Gm-Message-State: AOJu0YzuggUz85FwnWy9I5yu3fOnl/FXNSdckKTIRVKkzZhEZVQuCfAZ h5xKkEWNvx916Zg3jyaLpo468tuwmiFQUUUfxPfVzEajhGo= X-Received: by 2002:a05:600c:a45:b0:40e:3511:2c39 with SMTP id c5-20020a05600c0a4500b0040e35112c39mr1355661wmq.172.1704469583308; Fri, 05 Jan 2024 07:46:23 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id w17-20020a05600c475100b0040d802a7619sm1924026wmo.38.2024.01.05.07.46.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell Subject: [PULL 29/71] hw/arm/virt: Check CPU type in machine_run_board_init() Date: Fri, 5 Jan 2024 16:42:22 +0100 Message-ID: <20240105154307.21385-30-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do the check by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20231204004726.483558-7-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/virt.c | 62 +++++++++++++++++++-------------------------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 8b060ef1d9..2793121cb4 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -204,40 +204,6 @@ static const int a15irqmap[] = { [VIRT_PLATFORM_BUS] = 112, /* ...to 112 + PLATFORM_BUS_NUM_IRQS -1 */ }; -static const char *valid_cpus[] = { -#ifdef CONFIG_TCG - ARM_CPU_TYPE_NAME("cortex-a7"), - ARM_CPU_TYPE_NAME("cortex-a15"), - ARM_CPU_TYPE_NAME("cortex-a35"), - ARM_CPU_TYPE_NAME("cortex-a55"), - ARM_CPU_TYPE_NAME("cortex-a72"), - ARM_CPU_TYPE_NAME("cortex-a76"), - ARM_CPU_TYPE_NAME("cortex-a710"), - ARM_CPU_TYPE_NAME("a64fx"), - ARM_CPU_TYPE_NAME("neoverse-n1"), - ARM_CPU_TYPE_NAME("neoverse-v1"), - ARM_CPU_TYPE_NAME("neoverse-n2"), -#endif - ARM_CPU_TYPE_NAME("cortex-a53"), - ARM_CPU_TYPE_NAME("cortex-a57"), -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) - ARM_CPU_TYPE_NAME("host"), -#endif - ARM_CPU_TYPE_NAME("max"), -}; - -static bool cpu_type_valid(const char *cpu) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(valid_cpus); i++) { - if (strcmp(cpu, valid_cpus[i]) == 0) { - return true; - } - } - return false; -} - static void create_randomness(MachineState *ms, const char *node) { struct { @@ -2042,11 +2008,6 @@ static void machvirt_init(MachineState *machine) unsigned int smp_cpus = machine->smp.cpus; unsigned int max_cpus = machine->smp.max_cpus; - if (!cpu_type_valid(machine->cpu_type)) { - error_report("mach-virt: CPU type %s not supported", machine->cpu_type); - exit(1); - } - possible_cpus = mc->possible_cpu_arch_ids(machine); /* @@ -2940,6 +2901,28 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); + static const char * const valid_cpu_types[] = { +#ifdef CONFIG_TCG + ARM_CPU_TYPE_NAME("cortex-a7"), + ARM_CPU_TYPE_NAME("cortex-a15"), + ARM_CPU_TYPE_NAME("cortex-a35"), + ARM_CPU_TYPE_NAME("cortex-a55"), + ARM_CPU_TYPE_NAME("cortex-a72"), + ARM_CPU_TYPE_NAME("cortex-a76"), + ARM_CPU_TYPE_NAME("cortex-a710"), + ARM_CPU_TYPE_NAME("a64fx"), + ARM_CPU_TYPE_NAME("neoverse-n1"), + ARM_CPU_TYPE_NAME("neoverse-v1"), + ARM_CPU_TYPE_NAME("neoverse-n2"), +#endif + ARM_CPU_TYPE_NAME("cortex-a53"), + ARM_CPU_TYPE_NAME("cortex-a57"), +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) + ARM_CPU_TYPE_NAME("host"), +#endif + ARM_CPU_TYPE_NAME("max"), + NULL + }; mc->init = machvirt_init; /* Start with max_cpus set to 512, which is the maximum supported by KVM. @@ -2966,6 +2949,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data) #else mc->default_cpu_type = ARM_CPU_TYPE_NAME("max"); #endif + mc->valid_cpu_types = valid_cpu_types; mc->get_default_cpu_node_id = virt_get_default_cpu_node_id; mc->kvm_type = virt_kvm_type; assert(!mc->get_hotplug_handler); From patchwork Fri Jan 5 15:42:23 2024 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: 760172 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105463wru; Fri, 5 Jan 2024 07:48:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTZ6JOn1nwXdqQAYbsze8Tem7jP5IayDXwNpLB/jXA2jIv37SxOELIyaIjgiUFOO4yBMf7 X-Received: by 2002:a05:622a:5cb:b0:425:962a:1973 with SMTP id d11-20020a05622a05cb00b00425962a1973mr2430836qtb.137.1704469722857; Fri, 05 Jan 2024 07:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469722; cv=none; d=google.com; s=arc-20160816; b=MKORBTcy59obpXWCVccajcIERoGSZFvOqgaLxeUrPLXt2GJOy5B9hZBOB2kmXm9feF VW4diXH2UgzhecjZR8bWisG8aee18u9XwsSLOQL1NlxeCfnlggd9N1Fc8ELq2K8ShXSR hyYrULmd++/is9KdDLOi7vYLt4LxbfjPU1rdMzL9PaTctflNCu0G2b5dkuEBQ/T1ylSI pPwU3AEf6BUxXpi6rBGAS9dgOVOcG8XWNF8Vpomgx9tRsZZtLk7626pZta9t8ooqQQjI PMo37buRfsdC0iyDsvjmofBzC3zpI8SxwySO+0tliazELitE4A/ECaKgeiDZ52TtoHT5 jYDw== 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=1hi5jkBMNGBwDBii6AMSMwfhTDlF/mIwoAbJvzijOtI=; fh=01uvjdnRqxrQMIijehkKba7mQP7dFS0QWXi67SxyC+g=; b=YAYXbnd3v9XF0IEV/1KYl9I3+Begjb7akncGo7blHEEenQXRYjrI8N208HO1hgUUXZ Kg/bMr0SUh2Ev1simX56oeI8HQJeKS6wHh28t+XsitDSSzkytBkKEpRSmjpw3LV6KZBT QlmxFbSIs7Jq3B9x0IqA0n9dPHPfysYygirLn2LAQqUc8jv8CddFgEOlRiY7SxkyW3yI wkISWyjml6k2liMXdkF/h5uANAwFD8XDDbWewhk2mNy8SWn+v0o/Sv+rHGloc4nERNYI U7Ta9AqdMe2GFB/bC6Ff6VYd2mQSVoQR3QQF1EmTKw+5UFkW0V6mipLDrwUOZRLQlnKV T24A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qCQrTSHe; 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 i5-20020ac85c05000000b004297dab56b2si279598qti.563.2024.01.05.07.48.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:48:42 -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=qCQrTSHe; 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 1rLmQC-00075s-6t; Fri, 05 Jan 2024 10:47: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 1rLmPO-0004JD-SU for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:56 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmP8-0003vS-0e for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:54 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33687627ad0so1402680f8f.2 for ; Fri, 05 Jan 2024 07:46:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469595; x=1705074395; darn=nongnu.org; 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=1hi5jkBMNGBwDBii6AMSMwfhTDlF/mIwoAbJvzijOtI=; b=qCQrTSHeb8lhQbAHPNaI2JAkUkJ1CVQkgO/ZBQF5lCeLNDuCcgM9afPxF+/FJ/TBhc zMxILoEuhw0Sw6EwTEQAVe/c0ZLzUf6jwnaD2ftjefVezmm8S3EBsHDvA18vn1bEKJ/O Kr38nY0Sb9XYsQoe7syHuCY3InuUs2WgWZkZkYtkFyUT4GmBiv6TLN4mQlKVp+/IRyp7 NWtEHAzcmjI3iX3PdR4vLqsXRA99q0FzH74EGUpqNhRHy5hYK9f/KTJzCGUMzx0syOpQ VyL1Jd/AkSnDIcdJ2joyzvcAciLEZW+/LJ9mYJPK8rUTQZ/j4WEzO32HhAuydZmb4Yf8 wOTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469595; x=1705074395; 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=1hi5jkBMNGBwDBii6AMSMwfhTDlF/mIwoAbJvzijOtI=; b=j+KeE4kvKSsid0KL0gMG/XGYxs1as45vnufEQsut7AbUI3rjYj3/NRGWQlZURjOx6b U18gtl09FRctUDNcLCAim/MSAaFe5rcQLTHfxFCpemh9rkLyD5/OG4KDI+qv/JoHOqVY BVW91cqVfctt5hEiQN8grC68lIm8PPk19XBBZqH4HZUSooSzDnVxXp/rLQu47sjI+g7s NYE99/r55MAQ8h7RvHZdVvH4z1f50DBijwgphkF3VVEIZG4lzb1OllqvGOSHmlZ9LtpJ BQYkfGPMlGfm3mPJ8WlOlIw3mJzUQIzkUnzp1URWx5ZrNpOrCbcdgRBHMDwaLW0NUCkV +p/w== X-Gm-Message-State: AOJu0Yy8c10wtk8HuywuMKf4DedaC5fvLS1+t5+Tj0vDOM0uWPY0VVT4 vA54LGFF0x/Hnixbw+B53PB14DaApEzfLqjkZMJ31GdFEE0= X-Received: by 2002:a5d:4808:0:b0:333:5665:fa86 with SMTP id l8-20020a5d4808000000b003335665fa86mr1445590wrq.18.1704469595241; Fri, 05 Jan 2024 07:46:35 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id o14-20020adfeace000000b0033690139ea5sm1617406wrn.44.2024.01.05.07.46.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:34 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Leif Lindholm , Richard Henderson , Radoslaw Biernacki , Peter Maydell , Marcin Juszkiewicz Subject: [PULL 30/71] hw/arm/sbsa-ref: Check CPU type in machine_run_board_init() Date: Fri, 5 Jan 2024 16:42:23 +0100 Message-ID: <20240105154307.21385-31-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Leif Lindholm Reviewed-by: Richard Henderson Message-ID: <20231204004726.483558-8-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/sbsa-ref.c | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index f3c9704693..477dca0637 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -145,27 +145,6 @@ static const int sbsa_ref_irqmap[] = { [SBSA_GWDT_WS0] = 16, }; -static const char * const valid_cpus[] = { - ARM_CPU_TYPE_NAME("cortex-a57"), - ARM_CPU_TYPE_NAME("cortex-a72"), - ARM_CPU_TYPE_NAME("neoverse-n1"), - ARM_CPU_TYPE_NAME("neoverse-v1"), - ARM_CPU_TYPE_NAME("neoverse-n2"), - ARM_CPU_TYPE_NAME("max"), -}; - -static bool cpu_type_valid(const char *cpu) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(valid_cpus); i++) { - if (strcmp(cpu, valid_cpus[i]) == 0) { - return true; - } - } - return false; -} - static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx) { uint8_t clustersz = ARM_DEFAULT_CPUS_PER_CLUSTER; @@ -733,11 +712,6 @@ static void sbsa_ref_init(MachineState *machine) const CPUArchIdList *possible_cpus; int n, sbsa_max_cpus; - if (!cpu_type_valid(machine->cpu_type)) { - error_report("sbsa-ref: CPU type %s not supported", machine->cpu_type); - exit(1); - } - if (kvm_enabled()) { error_report("sbsa-ref: KVM is not supported for this machine"); exit(1); @@ -898,10 +872,20 @@ static void sbsa_ref_instance_init(Object *obj) static void sbsa_ref_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a57"), + ARM_CPU_TYPE_NAME("cortex-a72"), + ARM_CPU_TYPE_NAME("neoverse-n1"), + ARM_CPU_TYPE_NAME("neoverse-v1"), + ARM_CPU_TYPE_NAME("neoverse-n2"), + ARM_CPU_TYPE_NAME("max"), + NULL, + }; mc->init = sbsa_ref_init; mc->desc = "QEMU 'SBSA Reference' ARM Virtual Machine"; mc->default_cpu_type = ARM_CPU_TYPE_NAME("neoverse-n1"); + mc->valid_cpu_types = valid_cpu_types; mc->max_cpus = 512; mc->pci_allow_0_address = true; mc->minimum_page_bits = 12; From patchwork Fri Jan 5 15:42:24 2024 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: 760185 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106217wru; Fri, 5 Jan 2024 07:50:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIK9wXTJDI6CsymGdnl/UbV2R1t47k9WzdvTPAUFw0UN158jD6acQhT/VrMzj59WD5Hsej X-Received: by 2002:a05:6808:19a3:b0:3bc:35d0:e9c7 with SMTP id bj35-20020a05680819a300b003bc35d0e9c7mr1209107oib.10.1704469821837; Fri, 05 Jan 2024 07:50:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469821; cv=none; d=google.com; s=arc-20160816; b=WUYQXqt/LXO3s6gl97y3KteDKHhiwi6z5LJhpP7WBcUQJwH/FPEBRaoP1V4Rd3ilng YwRYrO2Dpsr0bEHwqVknVnd4I0SMilH+jAwb+t3IPmhZHuGeaBS6vn4eDuHbX6IuiYiG sgXFjlahIkHixgschsPqrXbEYPbLIFEFm+99q3pS1VLPXbcqxTodBiiM4eBNiG+Kr2nC Myt9YG21NHEdWDT2MX/uNKX85yYRYnhlW+ObeIb1QA/XxbsMCK3GNnbJWBmcdKcoLvpW R4r+1qt6a3ogNWyNrJ/Kefz+IEzq7fEaTjs2OthTRbe6KBgy8LGnIyrgtRDLR7D9snwn 65RA== 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=igqP4AsDHHqLX93X0pavaFsHsYcJ7nUJnv89zKZWOB0=; fh=kUbQUJK/acJfog3zG8z1oELJnkuE1Kk4Nkbe/a0ZWZ4=; b=AezSsx+MaBgqoah1j+NjRgG7YiboLFLgSJPxvBpZcpo2HcWRqKOyEkmDOHQVW54dwV TAoKQG73udZdLgs/630Fm/bcKfIRJUldC4flDakj7skbjBUUmyyY98SmoQblXDwH9Huy jfvt5YRKz1Wh2WJgyQVPONha+64M9TqOTXlWnc+CQvhJ2OTO1TZXTVQvC+Yppb0lkdQp VvveRQTPpE7q3DehxxyEs1BowUgNvxpmgwYXh0G8oqwRV/00S75UBY/crQ56mLxYBizz NLhLK6AGzAxJLy2C3fCVbDHj7Rs7Mpaak2hVo5yO0k4g7fDbNNH9E6k4oPgFMMaE0aiO OrKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QC17MOec; 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 v11-20020a0cdd8b000000b0067f65b3857bsi1997813qvk.15.2024.01.05.07.50.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:50:21 -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=QC17MOec; 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 1rLmQf-00009g-3i; Fri, 05 Jan 2024 10:48: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 1rLmPQ-0004Kv-TC for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:58 -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 1rLmPF-0003wy-Ry for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:54 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40d76fefd6bso14830575e9.2 for ; Fri, 05 Jan 2024 07:46:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469602; x=1705074402; darn=nongnu.org; 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=igqP4AsDHHqLX93X0pavaFsHsYcJ7nUJnv89zKZWOB0=; b=QC17MOec52OREMZe7sLa+OQlzzPWdGrwnn2BHI79sZdQg75ddLDVYhdyOkO55H+fqR P6I1MwOJT3kTfFqDV4pAyWdJ/HIsWHVnFXhP+2McFPXL9PbXK7lqAcAnVjM+a+LYiSYz 4pOH90fuXbOorBshUxXXgucOFjS43vnkzIZBaizo2N0y28w0Ji+7fHwkQjUWSbEPZ4pY aBN9ekRa4WKi+Rkhb6YNsb8yodjolTCUI6o/lNf/HmnL7KbmhYxf0VxVPWT71VDOiQPl dkc10bgW/j2L9aCi1y4rnbFfRxvIIeTS/0dtp3eEp2PCPhn6DVQlOz2P8KKYqBn54ki9 YhlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469602; x=1705074402; 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=igqP4AsDHHqLX93X0pavaFsHsYcJ7nUJnv89zKZWOB0=; b=CIoIoAqULPLRlpoOK47WdNwyMYh95BP5waeZZBqEap4kHQcKB5RiaDBxjZMtJCXrXR luh2rPip0uKhGzVVZ7kAlz5pbyXWia7YkYTu9oE9GyieJ+yp0iarDEwh2+tKdslOBRzD ygmZTZ60IzwrTuD3DD6LwxgpaxQb0D0IHodT4o6wixiHPudHUCpnjjhv9J7CVF1zh9G2 cQCZ2/cXCOC5MZ3Yk5vaDX5RSkTASTk3ZDbOomMEXuiIR2CvahJe/gPEh0fF08z28vcf fj2zziprU/CCpcLlTxcegIGypr+ZWFoJhg9tQyh2WqXqjJNkl/KVrKI4jnE43Pd7vRkz gxsQ== X-Gm-Message-State: AOJu0YzJnRVYsChEHU6pmo8/H4qagNsh0VnWPcGgnZ6345d3wk4AUijY 7kTUkX4rj3onC8/eibirg7O564PFZMXZD6S+Unv4vat0zKE= X-Received: by 2002:a05:600c:3798:b0:40d:81c1:186 with SMTP id o24-20020a05600c379800b0040d81c10186mr664385wmr.155.1704469602022; Fri, 05 Jan 2024 07:46:42 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id t11-20020a05600c450b00b0040d724896cbsm1936432wmo.18.2024.01.05.07.46.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Peter Maydell , Beniamino Galvani , Strahinja Jankovic , Subbaraya Sundeep , Tyrone Ting , Hao Wu , Niek Linnenbank Subject: [PULL 31/71] hw/arm: Check CPU type in machine_run_board_init() Date: Fri, 5 Jan 2024 16:42:24 +0100 Message-ID: <20240105154307.21385-32-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231204004726.483558-9-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/bananapi_m2u.c | 12 ++++++------ hw/arm/cubieboard.c | 12 ++++++------ hw/arm/mps2-tz.c | 26 ++++++++++++++++++++------ hw/arm/mps2.c | 26 ++++++++++++++++++++------ hw/arm/msf2-som.c | 12 ++++++------ hw/arm/musca.c | 12 +++++------- hw/arm/npcm7xx_boards.c | 12 +++++------- hw/arm/orangepi.c | 12 ++++++------ 8 files changed, 74 insertions(+), 50 deletions(-) diff --git a/hw/arm/bananapi_m2u.c b/hw/arm/bananapi_m2u.c index 8f24b18d8c..0a4b6f29b1 100644 --- a/hw/arm/bananapi_m2u.c +++ b/hw/arm/bananapi_m2u.c @@ -71,12 +71,6 @@ static void bpim2u_init(MachineState *machine) exit(1); } - /* Only allow Cortex-A7 for this board */ - if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a7")) != 0) { - error_report("This board can only be used with cortex-a7 CPU"); - exit(1); - } - r40 = AW_R40(object_new(TYPE_AW_R40)); object_property_add_child(OBJECT(machine), "soc", OBJECT(r40)); object_unref(OBJECT(r40)); @@ -133,12 +127,18 @@ static void bpim2u_init(MachineState *machine) static void bpim2u_machine_init(MachineClass *mc) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a7"), + NULL + }; + mc->desc = "Bananapi M2U (Cortex-A7)"; mc->init = bpim2u_init; mc->min_cpus = AW_R40_NUM_CPUS; mc->max_cpus = AW_R40_NUM_CPUS; mc->default_cpus = AW_R40_NUM_CPUS; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); + mc->valid_cpu_types = valid_cpu_types; mc->default_ram_size = 1 * GiB; mc->default_ram_id = "bpim2u.ram"; } diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index 29146f5018..b976727eef 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -52,12 +52,6 @@ static void cubieboard_init(MachineState *machine) exit(1); } - /* Only allow Cortex-A8 for this board */ - if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a8")) != 0) { - error_report("This board can only be used with cortex-a8 CPU"); - exit(1); - } - a10 = AW_A10(object_new(TYPE_AW_A10)); object_property_add_child(OBJECT(machine), "soc", OBJECT(a10)); object_unref(OBJECT(a10)); @@ -114,8 +108,14 @@ static void cubieboard_init(MachineState *machine) static void cubieboard_machine_init(MachineClass *mc) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a8"), + NULL + }; + mc->desc = "cubietech cubieboard (Cortex-A8)"; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8"); + mc->valid_cpu_types = valid_cpu_types; mc->default_ram_size = 1 * GiB; mc->init = cubieboard_init; mc->block_default_type = IF_IDE; diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 668db5ed61..5d8cdc1a4c 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -813,12 +813,6 @@ static void mps2tz_common_init(MachineState *machine) int num_ppcs; int i; - if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { - error_report("This board can only be used with CPU %s", - mc->default_cpu_type); - exit(1); - } - if (machine->ram_size != mc->default_ram_size) { char *sz = size_to_str(mc->default_ram_size); error_report("Invalid RAM size, should be %s", sz); @@ -1318,6 +1312,10 @@ static void mps2tz_an505_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m33"), + NULL + }; mc->desc = "ARM MPS2 with AN505 FPGA image for Cortex-M33"; mc->default_cpus = 1; @@ -1325,6 +1323,7 @@ static void mps2tz_an505_class_init(ObjectClass *oc, void *data) mc->max_cpus = mc->default_cpus; mmc->fpga_type = FPGA_AN505; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m33"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41045050; mmc->sysclk_frq = 20 * 1000 * 1000; /* 20MHz */ mmc->apb_periph_frq = mmc->sysclk_frq; @@ -1347,6 +1346,10 @@ static void mps2tz_an521_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m33"), + NULL + }; mc->desc = "ARM MPS2 with AN521 FPGA image for dual Cortex-M33"; mc->default_cpus = 2; @@ -1354,6 +1357,7 @@ static void mps2tz_an521_class_init(ObjectClass *oc, void *data) mc->max_cpus = mc->default_cpus; mmc->fpga_type = FPGA_AN521; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m33"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41045210; mmc->sysclk_frq = 20 * 1000 * 1000; /* 20MHz */ mmc->apb_periph_frq = mmc->sysclk_frq; @@ -1376,6 +1380,10 @@ static void mps3tz_an524_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m33"), + NULL + }; mc->desc = "ARM MPS3 with AN524 FPGA image for dual Cortex-M33"; mc->default_cpus = 2; @@ -1383,6 +1391,7 @@ static void mps3tz_an524_class_init(ObjectClass *oc, void *data) mc->max_cpus = mc->default_cpus; mmc->fpga_type = FPGA_AN524; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m33"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41045240; mmc->sysclk_frq = 32 * 1000 * 1000; /* 32MHz */ mmc->apb_periph_frq = mmc->sysclk_frq; @@ -1410,6 +1419,10 @@ static void mps3tz_an547_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m55"), + NULL + }; mc->desc = "ARM MPS3 with AN547 FPGA image for Cortex-M55"; mc->default_cpus = 1; @@ -1417,6 +1430,7 @@ static void mps3tz_an547_class_init(ObjectClass *oc, void *data) mc->max_cpus = mc->default_cpus; mmc->fpga_type = FPGA_AN547; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m55"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41055470; mmc->sysclk_frq = 32 * 1000 * 1000; /* 32MHz */ mmc->apb_periph_frq = 25 * 1000 * 1000; /* 25MHz */ diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c index 292a180ad2..bd873cc5de 100644 --- a/hw/arm/mps2.c +++ b/hw/arm/mps2.c @@ -142,12 +142,6 @@ static void mps2_common_init(MachineState *machine) QList *oscclk; int i; - if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { - error_report("This board can only be used with CPU %s", - mc->default_cpu_type); - exit(1); - } - if (machine->ram_size != mc->default_ram_size) { char *sz = size_to_str(mc->default_ram_size); error_report("Invalid RAM size, should be %s", sz); @@ -484,10 +478,15 @@ static void mps2_an385_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2MachineClass *mmc = MPS2_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m3"), + NULL + }; mc->desc = "ARM MPS2 with AN385 FPGA image for Cortex-M3"; mmc->fpga_type = FPGA_AN385; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41043850; mmc->psram_base = 0x21000000; mmc->ethernet_base = 0x40200000; @@ -498,10 +497,15 @@ static void mps2_an386_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2MachineClass *mmc = MPS2_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m4"), + NULL + }; mc->desc = "ARM MPS2 with AN386 FPGA image for Cortex-M4"; mmc->fpga_type = FPGA_AN386; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41043860; mmc->psram_base = 0x21000000; mmc->ethernet_base = 0x40200000; @@ -512,10 +516,15 @@ static void mps2_an500_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2MachineClass *mmc = MPS2_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m7"), + NULL + }; mc->desc = "ARM MPS2 with AN500 FPGA image for Cortex-M7"; mmc->fpga_type = FPGA_AN500; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m7"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41045000; mmc->psram_base = 0x60000000; mmc->ethernet_base = 0xa0000000; @@ -526,10 +535,15 @@ static void mps2_an511_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); MPS2MachineClass *mmc = MPS2_MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m3"), + NULL + }; mc->desc = "ARM MPS2 with AN511 DesignStart FPGA image for Cortex-M3"; mmc->fpga_type = FPGA_AN511; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3"); + mc->valid_cpu_types = valid_cpu_types; mmc->scc_id = 0x41045110; mmc->psram_base = 0x21000000; mmc->ethernet_base = 0x40200000; diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c index 7b3106c790..eb74b23797 100644 --- a/hw/arm/msf2-som.c +++ b/hw/arm/msf2-som.c @@ -55,12 +55,6 @@ static void emcraft_sf2_s2s010_init(MachineState *machine) MemoryRegion *ddr = g_new(MemoryRegion, 1); Clock *m3clk; - if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { - error_report("This board can only be used with CPU %s", - mc->default_cpu_type); - exit(1); - } - memory_region_init_ram(ddr, NULL, "ddr-ram", DDR_SIZE, &error_fatal); memory_region_add_subregion(sysmem, DDR_BASE_ADDRESS, ddr); @@ -106,9 +100,15 @@ static void emcraft_sf2_s2s010_init(MachineState *machine) static void emcraft_sf2_machine_init(MachineClass *mc) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m3"), + NULL + }; + mc->desc = "SmartFusion2 SOM kit from Emcraft (M2S010)"; mc->init = emcraft_sf2_s2s010_init; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m3"); + mc->valid_cpu_types = valid_cpu_types; } DEFINE_MACHINE("emcraft-sf2", emcraft_sf2_machine_init) diff --git a/hw/arm/musca.c b/hw/arm/musca.c index 6eeee57c9d..770ec1a15c 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -355,7 +355,6 @@ static void musca_init(MachineState *machine) { MuscaMachineState *mms = MUSCA_MACHINE(machine); MuscaMachineClass *mmc = MUSCA_MACHINE_GET_CLASS(mms); - MachineClass *mc = MACHINE_GET_CLASS(machine); MemoryRegion *system_memory = get_system_memory(); DeviceState *ssedev; DeviceState *dev_splitter; @@ -366,12 +365,6 @@ static void musca_init(MachineState *machine) assert(mmc->num_irqs <= MUSCA_NUMIRQ_MAX); assert(mmc->num_mpcs <= MUSCA_MPC_MAX); - if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { - error_report("This board can only be used with CPU %s", - mc->default_cpu_type); - exit(1); - } - mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); clock_set_hz(mms->sysclk, SYSCLK_FRQ); mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK"); @@ -604,11 +597,16 @@ static void musca_init(MachineState *machine) static void musca_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-m33"), + NULL + }; mc->default_cpus = 2; mc->min_cpus = mc->default_cpus; mc->max_cpus = mc->default_cpus; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-m33"); + mc->valid_cpu_types = valid_cpu_types; mc->init = musca_init; } diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 2aef579aac..2999b8b96d 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -121,15 +121,8 @@ static NPCM7xxState *npcm7xx_create_soc(MachineState *machine, uint32_t hw_straps) { NPCM7xxMachineClass *nmc = NPCM7XX_MACHINE_GET_CLASS(machine); - MachineClass *mc = MACHINE_CLASS(nmc); Object *obj; - if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { - error_report("This board can only be used with %s", - mc->default_cpu_type); - exit(1); - } - obj = object_new_with_props(nmc->soc_type, OBJECT(machine), "soc", &error_abort, NULL); object_property_set_uint(obj, "power-on-straps", hw_straps, &error_abort); @@ -463,12 +456,17 @@ static void npcm7xx_set_soc_type(NPCM7xxMachineClass *nmc, const char *type) static void npcm7xx_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; mc->no_floppy = 1; mc->no_cdrom = 1; mc->no_parallel = 1; mc->default_ram_id = "ram"; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a9"); + mc->valid_cpu_types = valid_cpu_types; } /* diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c index f3784d45ca..77e328191d 100644 --- a/hw/arm/orangepi.c +++ b/hw/arm/orangepi.c @@ -49,12 +49,6 @@ static void orangepi_init(MachineState *machine) exit(1); } - /* Only allow Cortex-A7 for this board */ - if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a7")) != 0) { - error_report("This board can only be used with cortex-a7 CPU"); - exit(1); - } - h3 = AW_H3(object_new(TYPE_AW_H3)); object_property_add_child(OBJECT(machine), "soc", OBJECT(h3)); object_unref(OBJECT(h3)); @@ -111,6 +105,11 @@ static void orangepi_init(MachineState *machine) static void orangepi_machine_init(MachineClass *mc) { + static const char * const valid_cpu_types[] = { + ARM_CPU_TYPE_NAME("cortex-a7"), + NULL + }; + mc->desc = "Orange Pi PC (Cortex-A7)"; mc->init = orangepi_init; mc->block_default_type = IF_SD; @@ -119,6 +118,7 @@ static void orangepi_machine_init(MachineClass *mc) mc->max_cpus = AW_H3_NUM_CPUS; mc->default_cpus = AW_H3_NUM_CPUS; mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); + mc->valid_cpu_types = valid_cpu_types; mc->default_ram_size = 1 * GiB; mc->default_ram_id = "orangepi.ram"; } From patchwork Fri Jan 5 15:42:25 2024 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: 760173 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105521wru; Fri, 5 Jan 2024 07:48:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPQ2PP3Ww26j5gypbvARZhdniclTxkxa7O8JV6W3x1W0CiWdrh8vsfQoe1JCV5gbGOgxgN X-Received: by 2002:a05:620a:640f:b0:783:518:360c with SMTP id pz15-20020a05620a640f00b007830518360cmr2284773qkn.8.1704469730098; Fri, 05 Jan 2024 07:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469730; cv=none; d=google.com; s=arc-20160816; b=YjEQrQWkbTAQwtLoqY/dof1p8U6QMZUWTvarfVCuPEBdv93rZJI5Wgoe5h0EXl9dLE y8V1VlqYwSxoeKGBZ51DSFYLmgtZaU14fsuRaopyHRt38AvjZUCzLgJq9i54y6/bc5VS LENIdfORRvAxKWK55vOlcDOkc1SIvD2iufktUwRolos8PvkDVpcOXsdgJKXflAD6kYP4 fd0qdFvuY9qiF0MMsaibeoEaFI2Kk6grgbgjMUTO1lG7d6QDiznlDeOuaPrAV/ggfUCD Y/4wYe5K5Tqg4znnK9879SZxIdF9cKMZqrzDK4qh/90FyIqstAq/kbWtengIw5U/MH81 pJAA== 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=H4P3qee4jFL51Nbb/746jQf4mN+fePYfOB7VeiIaJ9s=; fh=5Ta8+zkVYsUaAj/mRnVEpKYttBANBvhDfDKAxLPIHLM=; b=F8IIwNVKauyrKY5ku9uYp5pTnn0qRn3eSMFl0EY+cDZUiQ88N1qL9TYO5Yh3NWSjyl /RY7j9Cov49ZYdghIvZh7PHoc6JVBdknxGXxYQvVkWKQgNJS3uOg4B2xVqbaEzwNthKo Of2Rh634LFxDptpz395NeHDOt8w+pCVJluYtfwflhE2eSfdR91c8yQ7O0AB6z6ZDG/Lc TQpqXubSwlSHLI7AzmrvzVbp5QkGVxb6XR098q2uRTfdlD4vjB1wijgK49xTi7SWNv73 eTg3J2kJ6+0Rpx3iwM4zRnqtFGrxqWeNwKsvSfBkQWHGjsXM2eG1TCYBC9DsDunLQ523 W5nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kkwah4b1; 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 m2-20020a05620a24c200b00781d1750407si2007222qkn.637.2024.01.05.07.48.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:48:50 -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=Kkwah4b1; 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 1rLmQQ-00084E-1Z; Fri, 05 Jan 2024 10:47:59 -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 1rLmPQ-0004L1-V9 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:58 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmPJ-0003yA-CP for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:56 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3368b1e056eso1398869f8f.3 for ; Fri, 05 Jan 2024 07:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469608; x=1705074408; darn=nongnu.org; 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=H4P3qee4jFL51Nbb/746jQf4mN+fePYfOB7VeiIaJ9s=; b=Kkwah4b1tougeMRIpTCAQAwZ9p+kwT5uP9F0d1TekDZxKNFruCjHlyyMhiRX/Eaq5Y 620c6kZHtKSeyiKEdKRLGJpUM+wRdzTLIY1sAWXrDEbW9OnKXBKyPrVdxXOGm5aIiCEV EThdXcWqHbRbHXDHBIXJ/REptiyqGo5hX5F+fFLoCxiIC6puZ/cTTiP9sdNeBeuBGtWe EYROdmlU8GkXnBy1y0PhRsD9TiIIMQsRoqLeqGFXFc/x8sYh/Aew/MXHLuAi8H7WhNwz gRT3HYkCGkE3vheDOhyo7w8g+XACjxGXEIa0DMGezH5n5CPlcoVZQGPTX6CNyAzXrRGe wZRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469608; x=1705074408; 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=H4P3qee4jFL51Nbb/746jQf4mN+fePYfOB7VeiIaJ9s=; b=PrvcXaMqpBDm1nAvhYA3or4JcmGwS1Qa8uNoG0N02145MnGQN3fT2b83e7vudXgbHh TQ6zzolm+sLyA4anD+y93OVsI+yN7uV1eRyXOD52jiKSeB+7j502Deia/aICsdaj9zMP /jjj4ZuL91vFKRvrn1NFj1bV3zYK5v/Dafme6LBedbHcx9TCHBohgkrZZ3jxLDtaPUSq k7AdmHnhaGUu2Slw+krvsYvchKsGTqwIUc2MdUQf50CLmbAR/Rv8PtEt/bBlnO0jQH5M WRaJdRVXiTvsoAPIUIcUDaSfsGNRh89w6xz6tgRS9uUULKioQ6TqOXNftP55RIEWFM46 iWIg== X-Gm-Message-State: AOJu0YxSmjRw/ez7ih31zUHpncZphCDQSM8hswjXkSQ5WQ0zrhCyCZCi NxkeCi1RIF+GLM0sUNfX5WpRYpLFWWZ/Nt48uXc+KSGy63A= X-Received: by 2002:a05:6000:1972:b0:337:4221:5525 with SMTP id da18-20020a056000197200b0033742215525mr1273664wrb.46.1704469607760; Fri, 05 Jan 2024 07:46:47 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id d18-20020adff2d2000000b003374d8306cesm1606073wrp.86.2024.01.05.07.46.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Gavin Shan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Vijai Kumar K , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PULL 32/71] hw/riscv/shakti_c: Check CPU type in machine_run_board_init() Date: Fri, 5 Jan 2024 16:42:25 +0100 Message-ID: <20240105154307.21385-33-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Gavin Shan Set mc->valid_cpu_types so that the user specified CPU type can be validated in machine_run_board_init(). We needn't to do it by ourselves. Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231204004726.483558-10-gshan@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/riscv/shakti_c.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hw/riscv/shakti_c.c b/hw/riscv/shakti_c.c index 12ea74b032..3888034c2b 100644 --- a/hw/riscv/shakti_c.c +++ b/hw/riscv/shakti_c.c @@ -28,7 +28,6 @@ #include "exec/address-spaces.h" #include "hw/riscv/boot.h" - static const struct MemmapEntry { hwaddr base; hwaddr size; @@ -47,12 +46,6 @@ static void shakti_c_machine_state_init(MachineState *mstate) ShaktiCMachineState *sms = RISCV_SHAKTI_MACHINE(mstate); MemoryRegion *system_memory = get_system_memory(); - /* Allow only Shakti C CPU for this platform */ - if (strcmp(mstate->cpu_type, TYPE_RISCV_CPU_SHAKTI_C) != 0) { - error_report("This board can only be used with Shakti C CPU"); - exit(1); - } - /* Initialize SoC */ object_initialize_child(OBJECT(mstate), "soc", &sms->soc, TYPE_RISCV_SHAKTI_SOC); @@ -82,9 +75,15 @@ static void shakti_c_machine_instance_init(Object *obj) static void shakti_c_machine_class_init(ObjectClass *klass, void *data) { MachineClass *mc = MACHINE_CLASS(klass); + static const char * const valid_cpu_types[] = { + RISCV_CPU_TYPE_NAME("shakti-c"), + NULL + }; + mc->desc = "RISC-V Board compatible with Shakti SDK"; mc->init = shakti_c_machine_state_init; mc->default_cpu_type = TYPE_RISCV_CPU_SHAKTI_C; + mc->valid_cpu_types = valid_cpu_types; mc->default_ram_id = "riscv.shakti.c.ram"; } From patchwork Fri Jan 5 15:42:26 2024 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: 760200 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107622wru; Fri, 5 Jan 2024 07:53:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHolL2+O0w42WXSyzK0hvbQCSffZwg0dHET1EJvENVfgTOQOxYpCntN8bNb2R+mRFSEkUKJ X-Received: by 2002:ac8:7f42:0:b0:428:3306:ddf5 with SMTP id g2-20020ac87f42000000b004283306ddf5mr2598127qtk.59.1704470014953; Fri, 05 Jan 2024 07:53:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470014; cv=none; d=google.com; s=arc-20160816; b=uIF1yiqNBIlNLp/UVkgCACeLnPEYGPbgkNMoM436KTmJo8uvJ23j2qJOcGJQmlntd3 StCA1qUnaL+K9ZCPzqUgQrk8ahbY2b3cgtszgb4cRFHVY491egtKF2+M8xZ6DQ9jCSpe 15LvpVr1Wjo/ewD/Se7w75qsmYlysecVEo8uxwUk4ClgaXC0nmC8oJazVWXDNRSgNq/i DAv5ZUe0iW1Ngo5jDIOs6f/PcKqCWgUN6adGtRvubQtSF0xjuoGbfdRB1Wa3aZVTPmDO aB2LJGORH8Kv6OQqSRse+CopVG7ReWungx8RJxA4LgIp3Uu8K7Rm40ZRtw/oncSvCPN/ /FNQ== 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=cFGPQoyiNDNESAoFxHgGgEpoIvyyYwdHUPQolOFmxbE=; fh=DS/sjFVyRjQZ2Knf0JWk3Zjoc6VB85xSzRN3yPTMPCU=; b=mMVq4FDCYOfRMx0VSUwXdaGJ9KIRy21TwKmILWeWSTlk8IJ2sAFkFjg6T9EGuRuOMg sekSgiXS4f1uBtWIGPEZ8434dyT5JdzbyjRXXKGr1GrJAa5aTcK2ORYDR5kQlbge346c To2e/74WYVbz0Ivt/y+amrne8cw/Qb4YGctplYRGvUfcXwDw9ax7sEt06MqAGjZBAkDU 3CH4lIY6qQBtGQTwgKVGsG+yjp5yxvZrttI2vmNdyWjr+qjMOfQfwvCAp3zsakvN4Z/Q ujDGUWXXbmeTatIMuHCSNxbVWajRQQaqqQIfKct6PbCK+OirRbo5BgxLk+MzX5OqupMf PchA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yDHJUZtu; 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 bp34-20020a05622a1ba200b0042839f5ebc5si2016401qtb.694.2024.01.05.07.53.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53:34 -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=yDHJUZtu; 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 1rLmQv-00017n-Rh; Fri, 05 Jan 2024 10:48:30 -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 1rLmPT-0004OO-0c for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:00 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmPO-0003za-Pw for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:46:58 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-33687627ad0so1403136f8f.2 for ; Fri, 05 Jan 2024 07:46:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469613; x=1705074413; darn=nongnu.org; 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=cFGPQoyiNDNESAoFxHgGgEpoIvyyYwdHUPQolOFmxbE=; b=yDHJUZtuJ+/pbAiwQ7FJM6Y7cA9os0eiFqDzVhm3WM69UHx4LvAMpspc3VSq7FMsfr Qg2vgeASyHqK9nB1MgQMnbKrjeBKPFzmMg5CZWEuM75fok6QhuEVX1TmGUVp7EwgTwQA Uq/I+c4a4ig9NuVW6dAFhlcattXWiYKYA+lOmxuL2UdTn/SnAockYNgdNMTQm7BkzUW1 oB+JMyvUUfWNp6dVTX726vWXDydMFhE2ZcrVd7aGugP7beY28JgxT6lyC3tzEWEnDcLz XhmWIUXQdOGuH5rQjN4/955fObhC8wi3LJiZ2eMw7OIEORdf+0XmFJqlNiQAJxjNjs+E DVIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469613; x=1705074413; 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=cFGPQoyiNDNESAoFxHgGgEpoIvyyYwdHUPQolOFmxbE=; b=GcnaTJNQ+VZXFKvc2GxM8mw7+BiK0NIdHPshgNbJ7VhwpNhCzjF36DLESrSg3K10EY GN4GCauWi7eFNIGVLeqiJWlTdEWqUtvHVHNtUBbMLI9OXUdGCWkt87qic1A48BFwZkGn lEylvWgdgkkpk62G14+fcYDloPiI//eo2ihVk/+uoxPljlBQhKo+YMRZCHHqnXTQ5BJY DZQsxYkayoKYluzlpBUTuDtMUofLYbPqUK6CuBBL2P5ArU7YN8sK/qIpSbAgjQsRxNs/ +N3vT/23bnwzHl83GDAd8rb18bPUYuBpPOPBY27bmLN8E+SYmGgcXwZWLHbW6KGyYUHk tjIw== X-Gm-Message-State: AOJu0YwmDS/uT+rJBtmm8113ooSKDMj2z7lxD6ZO5S3T0+X696kP2Pxk VZ5t8rNfi5X7AP4oqh2BT6UdpIpr+WUPstJLdLfyVHJS/7M= X-Received: by 2002:a5d:4b83:0:b0:337:49b6:8bea with SMTP id b3-20020a5d4b83000000b0033749b68beamr1188216wrt.78.1704469613220; Fri, 05 Jan 2024 07:46:53 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id u10-20020adfa18a000000b00336ca349bdesm1626770wru.47.2024.01.05.07.46.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 33/71] hw/core/cpu: Remove final vestiges of dynamic state tracing Date: Fri, 5 Jan 2024 16:42:26 +0100 Message-ID: <20240105154307.21385-34-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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, T_SCC_BODY_TEXT_LINE=-0.01 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 The dynamic state tracing was removed in commit d0aaf08bb9. Fixes: d0aaf08bb9 ("tcg: remove the final vestiges of dstate") Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231129182734.15565-1-philmd@linaro.org> --- include/hw/core/cpu.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 76ef59de0a..44ff954207 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -437,9 +437,6 @@ struct qemu_work_item; * @kvm_fd: vCPU file descriptor for KVM. * @work_mutex: Lock to prevent multiple access to @work_list. * @work_list: List of pending asynchronous work. - * @trace_dstate_delayed: Delayed changes to trace_dstate (includes all changes - * to @trace_dstate). - * @trace_dstate: Dynamic tracing state of events for this vCPU (bitmask). * @plugin_mask: Plugin event bitmap. Modified only via async work. * @ignore_memory_transaction_failures: Cached copy of the MachineState * flag of the same name: allows the board to suppress calling of the From patchwork Fri Jan 5 15:42:27 2024 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: 760179 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106048wru; Fri, 5 Jan 2024 07:49:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZNMIiEcuSWpKLpPP6ttvDuwEkc7USAkee2O2G6OulZCOCGUWt0NZTeEqIjtZ2k2NpzZh8 X-Received: by 2002:a05:6358:7250:b0:170:e2dc:3e19 with SMTP id i16-20020a056358725000b00170e2dc3e19mr2602158rwa.43.1704469797459; Fri, 05 Jan 2024 07:49:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469797; cv=none; d=google.com; s=arc-20160816; b=tU+djDvhI7rKnGvqoTcWqIqrEf1rk/rWK6WE0NbACtsQNYB1LS5N3YxtqRnNgFmsJY zZ0mtvFIDk7y5nSYVjof4oUvfzzSdOANLHUfih9JLsddwE1IUn8/MUKjhix2kJtuueNG eiQv2OWFIVwt2XBgR8AfadN9xiWKV/viPZ62IGvqMBX9MYh9HCrIZBCpSJiPlxY24jI0 upDSj9bDwb2iJuO0MeNdciJBs3oHcHatCV3cU0yNcgcCekxnKaTsYbyQecF9FYN2cPji uSd2W1YSrmxIKcbcsrsDoND2C+E95WVrEFGaohtumXUuQEkPJogZkpd4X/iRohYq6eK1 m9TA== 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=CbggecaPR1KDAEaq2ZCHfcAMG72AfEJs1+ws0Qr91Tw=; fh=DS/sjFVyRjQZ2Knf0JWk3Zjoc6VB85xSzRN3yPTMPCU=; b=fNdPk7Rq2VLf55WFS61SqvRjwFyssx02Is/zpL+7njx1F8/K/YIeq/PbjonzxMX6WE kwvinWcCOYsGT5FIZzlLgr5PVw2QdWUh+XzrPyLnqMty9pVaZlPDvjIzO4t3StA7nb/z GCVcsmuFm+OzisrQDvxodbqfLNIzo6E7jbE6g746826HDghYWkHgoZNxwXuO2eGhYVhP aeLtLlaJRZ3ZLeiCEQuln9ahtmc1K1dut6v4W2yHKrBoF9oUAJ3CmBfXdAF3cRTb4puU S58DwCuVfLC0H58w6NGKjZiR2vozImQK8N4OiJ0/0sNc/a9mvmFq9Na//kf3gZPwSz8i W/Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KOIgIvdl; 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 v11-20020a05622a144b00b00427eed70967si2070923qtx.547.2024.01.05.07.49.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:49:57 -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=KOIgIvdl; 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 1rLmQy-0001jY-Eg; Fri, 05 Jan 2024 10:48:32 -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 1rLmPX-0004We-NU for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:06 -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 1rLmPU-00041q-8Q for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:02 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40d4a7f0c4dso17389355e9.1 for ; Fri, 05 Jan 2024 07:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469618; x=1705074418; darn=nongnu.org; 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=CbggecaPR1KDAEaq2ZCHfcAMG72AfEJs1+ws0Qr91Tw=; b=KOIgIvdlo5bzOC3eFeSIBVzpCqo29wstSXlbatMD3Gb9Y1HMhUOTYtOqMTI5Xlp3sm PPppdL+O0nb/MiqF/ch2a3P+ypKdrQB0HTKB3XKbVpupd/etZdYwKn8I/NUhdfTCsCtq 8F3xqC029CcZGh/hT0QnBiK2bXSy5CwOxNn+BEOTyoUo91r+wo3iOOF4dFKxlJuB759k /KnTtcS959Dky4F0iLQT1S+AB+K4yCilYqyEaSepR0QiqV6nsGyfYYEQZoT16BhQ54LX NlGcAFYPHdxj5obvFZc2Qq037sJWEDrbei6/reDZXmZNruiKIoHpMYUCEz6An2rzcuEN +STw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469618; x=1705074418; 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=CbggecaPR1KDAEaq2ZCHfcAMG72AfEJs1+ws0Qr91Tw=; b=tlsrCohFDO/CWovexFW0gWXhB4webudWzNTwi5F1QzpHOUK91TDQ9VkXnVXJ7bY80P HjfJFtkcNZR0H5eHkint58R/eR7sCqGqC3SoERA3zk8YGlQPr0rED/bZhDAVaL0C1MxM xDRMPqFHU4NeP84Pm5QlHInZaRlZO0JygxtoCx57jJhna38425vLBd0AH/DT8Jx8huOS Gujo7bYYAKTXUF5QhMZ62GFfNlM9SZOg3NyV4nPacyUcrqQhjWVtR4JRKYqg96ErR+kE jxtltfU6mribIkSehoqv80UjznhYt0fCvwTElqHpHbax7E16HJ0Y5pHXRWi6k5mIklOf +eFg== X-Gm-Message-State: AOJu0Yz7qlovWLpoA+1iBW1OxjJ9TrN+lMW38vUUrCPgAXJbZLYx8Qn6 Zp33jyAYaPOSG60KYz/OT6ihjoVbduWCcYLGNW/J5BsluLM= X-Received: by 2002:a7b:c5d9:0:b0:40c:35b9:e2dd with SMTP id n25-20020a7bc5d9000000b0040c35b9e2ddmr1254424wmk.85.1704469618702; Fri, 05 Jan 2024 07:46:58 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id bi16-20020a05600c3d9000b0040d5ae2905asm1921248wmb.30.2024.01.05.07.46.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:46:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 34/71] hw/core/cpu: Update description of CPUState::node Date: Fri, 5 Jan 2024 16:42:27 +0100 Message-ID: <20240105154307.21385-35-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 'next_cpu' was converted to 'node' in commit bdc44640cb ("cpu: Use QTAILQ for CPU list"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-Id: <20231129183243.15859-1-philmd@linaro.org> --- include/hw/core/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 44ff954207..238c02c05e 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -430,7 +430,7 @@ struct qemu_work_item; * @gdb_regs: Additional GDB registers. * @gdb_num_regs: Number of total registers accessible to GDB. * @gdb_num_g_regs: Number of registers in GDB 'g' packets. - * @next_cpu: Next CPU sharing TB cache. + * @node: QTAILQ of CPUs sharing TB cache. * @opaque: User data. * @mem_io_pc: Host Program Counter at which the memory was accessed. * @accel: Pointer to accelerator specific state. From patchwork Fri Jan 5 15:42:28 2024 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: 760177 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105630wru; Fri, 5 Jan 2024 07:49:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWeHkMOSkSeZjN9T8lJQbnV2+iHrlPvWJE/skc7mh3s+0ho5s+djQ+CKLGU78syT/F5ZCZ X-Received: by 2002:a05:6870:348c:b0:203:9d13:5e97 with SMTP id n12-20020a056870348c00b002039d135e97mr2253500oah.37.1704469743854; Fri, 05 Jan 2024 07:49:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469743; cv=none; d=google.com; s=arc-20160816; b=QnoIVQrAFDM/iOjnUU8MQvx/V5pYJ8BLWosewg78UiT92cxMsf89TnUCgr/M23pTHS zej8nwKG0wZQ8R1ARxIjG9YE5WZzpbP6FtyacGNhh/EVrvvupiXlR+eM61p6XCyFePsU L9yVRvA2F/NATcV/p/3qpjYu6EG/gUANNskt204p3yFYRoNLqVTSkCynZzbZ8xDddjcE XU+xFbHjC5OQ+THzfOyyc3X0rdlJTqhwUC5ME0s4u1q1aiufA/y34KRLwZUR5V/qg7+I wphjH9FwwgSv/+mnjvQuDOTZVZjacYCWPDAEDP+8oG8Tt9drmYod/w8ftoL46pGrsezb JOcg== 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=1jtVroaWgerQaDsLUvyZtuo+bUywnLD5o4M9nlpDsZ0=; fh=uFEPBNZpg4OilTrLAI5I1ulaIPy80nGmoQshzjRJN+M=; b=mBFehLpQ0s6kSO2qMasyIpeUXtI4JBVgxL7mSgVOZRekXSsrQewuzm0x5cjl63hah6 3lIe37k4AqQKZDnHteKutF8yWWqns9qIYyzUQaWrhj1KFOKVEynSif2ssygpvVacXMz5 O5rx1vBDTNV7k3l6Vqm58LXHTmxiNZQtALEhSVs5wJEQwyhO1h265QwcM9mx3ChjHlP5 L+FR6aJpGHe3nRYT8u730pdsAMtoQIp0Z1xkLlcIFHzz6v7Id68piKhLE5T1fFYXnzIx RDt734A8XNDh5J3ylJfnOSRzZYC6mbcmSBOikpFtZETNuPUBvLxnjB+MtBEiROk4jxWm PmjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VDQijkwC; 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 os18-20020a05620a811200b0077f6ff697c6si1878605qkn.164.2024.01.05.07.49.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:49:03 -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=VDQijkwC; 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 1rLmQw-0001O4-O5; Fri, 05 Jan 2024 10:48:30 -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 1rLmPc-0004cE-2a for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:08 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmPZ-00043A-S5 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:07 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3367f8f8cb0so1468698f8f.2 for ; Fri, 05 Jan 2024 07:47:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469624; x=1705074424; darn=nongnu.org; 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=1jtVroaWgerQaDsLUvyZtuo+bUywnLD5o4M9nlpDsZ0=; b=VDQijkwCJ1HQdAfQ8E/PlYw7sxAyESEgnmZs6dVZKBNsnXMuMg6CBFOswzB1oBXfqb Ubf4CdJQL+seN+B9F+atrsqRkPt4pWS7x004/4aAwP3/r9aO0Nq1ThB8ekZbNZOt83yq LCLTsYha78OMsOfhiRfOgE+rU+NJYsScHk6fKIK39i4wzOj9snK6GL8wu+Pxu1W0iADH UtJS/T1ewG3je3XyHlqotnMpg0z6Fb+RkpiGizwE6v2mlLBxMrFKh+wrFsUP0MoXx5oj Sq5ZsNyq6OjI6uawou0unKvZPEMZGvGI197tzV8VNds4saxStWFRfOWHincotvqr1AW6 KMqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469624; x=1705074424; 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=1jtVroaWgerQaDsLUvyZtuo+bUywnLD5o4M9nlpDsZ0=; b=D4uZp3xaDsKpyc3ozj3Oby8Phda76fh579VdAL6rf3pNS4+PkN2VSt+7jD0XBwEhTN qQjh8ulx5ZNWMmyLt8PN+ASXVcfFjfIcwzVHeJ0V8AIzJ1rRwvp0VVdg9r/77Up/RD97 t/9uaKb9tARjRcL+FiUQaBHDpRD2LkRbcCaVa02SaUkKUb/Bm41Z313VWEzzcCn7UBJW nTh9tSsfq1BB1g8Jwt01N98kKWtrWJ5KZylTjc5NEigTDJkHHC/T06how/Xp3X/7y7Ww MpS5tVh4Z0OCfBpjYc8nxt5CirWmCEznq++64gFNnpBGvj0LVPI/0/9jzacljGi0M8Bh 481w== X-Gm-Message-State: AOJu0YymvdtB06JbFswOnfksb61tTDxR2JkgDzPnYh+4/y+/n9aNTeyQ Qp1Iq0lmHvzGOx/PGaqhOxy8K8HIKRGwgT3Jksi3c+/1JRE= X-Received: by 2002:a5d:4c46:0:b0:334:ada5:3835 with SMTP id n6-20020a5d4c46000000b00334ada53835mr1414314wrt.4.1704469623925; Fri, 05 Jan 2024 07:47:03 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id cx12-20020a056000092c00b00336b702af06sm1612524wrb.16.2024.01.05.07.47.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 35/71] hw/cpu/core: Cleanup unused included header in core.c Date: Fri, 5 Jan 2024 16:42:28 +0100 Message-ID: <20240105154307.21385-36-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Zhao Liu Remove unused header (qemu/module.h and sysemu/cpus.h) in core.c, and reorder the remaining header files (except qemu/osdep.h) in alphabetical order. Tested by "./configure" and then "make". Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231127145611.925817-2-zhao1.liu@linux.intel.com> --- hw/cpu/core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/cpu/core.c b/hw/cpu/core.c index 9876075155..495a5c30ff 100644 --- a/hw/cpu/core.c +++ b/hw/cpu/core.c @@ -8,12 +8,11 @@ */ #include "qemu/osdep.h" -#include "hw/cpu/core.h" -#include "qapi/visitor.h" -#include "qemu/module.h" -#include "qapi/error.h" -#include "sysemu/cpus.h" + #include "hw/boards.h" +#include "hw/cpu/core.h" +#include "qapi/error.h" +#include "qapi/visitor.h" static void core_prop_get_core_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) From patchwork Fri Jan 5 15:42:29 2024 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: 760209 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp108481wru; Fri, 5 Jan 2024 07:55:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgriUJzbYH48VANmZAKkOjKS+tw5P3fGTNRj6jkxmlGzm+wRyoXJIeBjWCFFr5QpWmode2 X-Received: by 2002:a05:6870:cb92:b0:205:daa8:445a with SMTP id ov18-20020a056870cb9200b00205daa8445amr1041451oab.13.1704470136931; Fri, 05 Jan 2024 07:55:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470136; cv=none; d=google.com; s=arc-20160816; b=u3OmgliRn5dQRVTsNNADXUET64UuJGg7mZ4v4WuW2nANBOYJ5FWYVhQRL1g28kzbU0 hk3lfBOcC+5rrlEzbLyK5yZjxArvfVdQhI5ER1XLpSFyKxX6JI2+hZmeyTlCcCLmZ0o4 6LXo9QY7PLgLeCKipM7GGQLqKhQhh7MA4Wj1i46lhLvDOTPO6WLYdq5pesSoYTgZ2WkO 12ajyY4JX0yumieesMXkCYEnN4KUr71ILEBlTLwZdy3K1YjVYZnd2MG/hqqeKrzmOV1D nXTrolTlr6H3Q/c63ElmR1jJnQ/ErZIn5dGTNkojeK6ZO5ywk4zcnh9e7+IEuaLxhx1n I2KA== 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=XEzWZCwZQ+htA+jgYj3rjLFf9tHBeYLo9LMvIOXJj6w=; fh=Tgok5Ja1XKXjD8fYA4+PGzfwRqVevtjAFIk/7/EPOqk=; b=xGuSpIc+04btG3xD79+qft54Kq7r1QdrvPRARBfH5NC5jv+5dkczpTDkSwm4l+MzG5 XUM0EOgn02B1lR/DPk+4vEOfw3JKZvUp3xj7LtCxHfkAuVNknks25TveHKSWpQjt64lK cy3iPLKH9dbCazwI19G/1O03oqOeUNWfk6Aw6ODLZL0Hej5B8x7DznWs4a3Yj6WnHxiQ JThaCbnYjmtIB3aNhYZjS4pL0SBP8eio0QJKjsmQnfrlp/fnpRaY9S4pbxBxNy/V2gNU zT690RtKLzB1by37lBH91mWTKsDherz6s+Jh9pu9ilKPi+hjzo59iO8uWau6Ji2jPeIQ U8pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nCXK817t; 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 j5-20020a37c245000000b00781a2c1d650si1949594qkm.764.2024.01.05.07.55.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:55:36 -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=nCXK817t; 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 1rLmQx-0001fN-VP; Fri, 05 Jan 2024 10:48:32 -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 1rLmPp-0005YB-UY for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:25 -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 1rLmPg-000449-CX for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:20 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40e3a67ca9fso3855415e9.0 for ; Fri, 05 Jan 2024 07:47:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469629; x=1705074429; darn=nongnu.org; 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=XEzWZCwZQ+htA+jgYj3rjLFf9tHBeYLo9LMvIOXJj6w=; b=nCXK817td/VnpUirjMpwSpCEYNUAYudv11qv9iNTOD7o68idIefMi81ju6uJ/gBNNQ qO+Aqq4ShJk7vh4MIfDQabsrn5Nv2Cxa+RBMTzZtZwAJvMOqgbd76jcr4Gyo7TGnopiP YKRkwriNpcIQW7RuKO1tLzBY9OFF5ftIeqgAUfVsWTFpyG430WBDUDoXzwVJ3+OzA2IP QnzqWnax+VuwrCJozRhB9zorZ2/94jgvaOINaHaQyZ2vn+r0qSvTfDkeEdhHIY2WvMur DEa25eVMa1pbXNcI2nwyUdp1+5ZbKKw81WFnRpS4C4B2XIRlQk6rKmn4W4ZQUQdStk0t nHbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469629; x=1705074429; 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=XEzWZCwZQ+htA+jgYj3rjLFf9tHBeYLo9LMvIOXJj6w=; b=qb5m7O2c1ug1nLhQL35ekKDJby5TNZVhClQi955zMjIkRVhJ8Pew217u1LG0tHPZ6f chgbKmb1JaCjcev7PKwqb5yBydUjG86M4ZbTlckPNK4LBdt+4pAY2XbHbs1mub5DQR2d CHs3CdNfDNlTgBB35Fl3rzdexwkrBZ/ZlO7tsCGkjp8CpWreUU6M4rigUGr9Hn4zy0Lp IYGhZSLWLtnyia08e9sq5pAfFjTaxn1+LbY3ZMZ6RkDFt2WduG5Ep/0h5cag8mHK7RzD +OnkDdRI/ULnfOmUDGlIZZg63qc2ngTT1xYnA4RP6qk+66m2fquoGKY50Xr2EB1Aiqvj yUZQ== X-Gm-Message-State: AOJu0YwytYrETflfxb8Vt8PcaLMqpNrbEJxq7pTd/EMBszy+rKUyDw4u mFrZ0+Ru790Gc5BPFkx1yQhWUl2soFIJRpdL/FQTMwLFUr8= X-Received: by 2002:a1c:790b:0:b0:40d:79ec:bb4f with SMTP id l11-20020a1c790b000000b0040d79ecbb4fmr1232048wme.26.1704469629159; Fri, 05 Jan 2024 07:47:09 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id l15-20020a5d410f000000b00336e43e8e57sm1612761wrp.58.2024.01.05.07.47.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang Subject: [PULL 36/71] hw/cpu/cluster: Cleanup unused included header in cluster.c Date: Fri, 5 Jan 2024 16:42:29 +0100 Message-ID: <20240105154307.21385-37-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Zhao Liu Remove unused header (qemu/module.h and qemu/cutils.h) in cluster.c, and reorder the remaining header files (except qemu/osdep.h) in alphabetical order. Tested by "./configure" and then "make". Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231127145611.925817-3-zhao1.liu@linux.intel.com> --- hw/cpu/cluster.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/cpu/cluster.c b/hw/cpu/cluster.c index e444b7c29d..61289a840d 100644 --- a/hw/cpu/cluster.c +++ b/hw/cpu/cluster.c @@ -19,12 +19,11 @@ */ #include "qemu/osdep.h" + +#include "hw/core/cpu.h" #include "hw/cpu/cluster.h" #include "hw/qdev-properties.h" -#include "hw/core/cpu.h" #include "qapi/error.h" -#include "qemu/module.h" -#include "qemu/cutils.h" static Property cpu_cluster_properties[] = { DEFINE_PROP_UINT32("cluster-id", CPUClusterState, cluster_id, 0), From patchwork Fri Jan 5 15:42:30 2024 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: 760187 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107000wru; Fri, 5 Jan 2024 07:52:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFC+cFSpX2rJ+aJ5GS/CQdCYRmVcwf2jwF4rlb19mAA1dADOfLCN8FKFut4LolfRd++FJn0 X-Received: by 2002:a05:6808:f0f:b0:3bc:2ea6:c93c with SMTP id m15-20020a0568080f0f00b003bc2ea6c93cmr2597812oiw.29.1704469934653; Fri, 05 Jan 2024 07:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469934; cv=none; d=google.com; s=arc-20160816; b=U74gfZ220bnj4WmNeU0ZmTiosg1iPyqtOJ0u/0hf5aWA9tcmZd2BqimjEznTvlvon4 4CExqKTbf5Q3fn9twoVVskcQoi5HBXuJrdA58uSfhCCTA/uCsbKQTdi6GsmrpyiJ1jYW RLXRfvXOrQwB+b9ZsEjfc/CbGZvvQBo5MYSFo2+3SThtkM95VgWRAfpcADt34WVT3mPw UbiSHWLVy7J99Un8eiGlGetxr5FQJqPx1TZJv1WYIQiteKRqYyVmlFdxCH4CTSrT5Yyt CxqyzjOoHGSxPXOor2mjh+B58pvjrXuTLB3Y50nOxZ94xL3Ku23xtKdx4pAZ3QZSMXx6 Lljw== 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=foPbRN9kgz3ubIukCDMoVcakJKSu99lNJLUQRej2Dsg=; fh=E/IMe+HuIHQOh8W/HP3CMZ0nY1WkCNldb1wsyc7BhE0=; b=GOERoIpsBvSqtCopLtCQfv0Z94WpiNQQdmCUxzhNktw1hPLCHmrfpNJ+Q8qR/xyl3B +3yunhKwyrcetkndUFzLEQW6MU/OX5wWtv7rjL5lQvD4rKmbJjnzcx3QjCpYpyRI+EOR r4qfcX/X9GNy5vrh9jU42GPfTiaq5qplUV79NBVIj2UUnzWMRx5DH8/dpRv5f6J82HYZ 4NGzBNUSio6GZnMZ87DlA5x0FqHj0OPG6dC6lKIGD+p01AXr9AFxSMBiC2yDl27rOu+j IdkyVatzSR5CHouPYj2rHZsaX+NtMQFN0uqcrDTosbelLBwUnet2wHfKPqpsEdhocVfZ IFZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pAJGDXvC; 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 j10-20020a05620a288a00b0078126fbd340si2019523qkp.596.2024.01.05.07.52.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52:14 -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=pAJGDXvC; 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 1rLmR2-0002Ab-0v; Fri, 05 Jan 2024 10:48:36 -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 1rLmPl-0005MS-La for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:19 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmPj-00045A-UF for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:17 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33748c4f33dso1402314f8f.1 for ; Fri, 05 Jan 2024 07:47:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469634; x=1705074434; darn=nongnu.org; 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=foPbRN9kgz3ubIukCDMoVcakJKSu99lNJLUQRej2Dsg=; b=pAJGDXvCXqCWtmEX24PENeF/S6BWfWmbADoC/oGYDGPwQKutZ5aONcv7Q3kSxSaRsj Vu1dKH40+YAhYVZ7ElIXYKG0OUx6y6xhkG8jaidL7xoZVDljyNVB9qb/gcn66glAF2Ej VADCTDYsNLlH/NBBSWO8K0crq+FVsvtxd1WsgGMiKvJDumxUi3bpkr0+gz1s5XSO55CQ 2H1E3rcmYnn9EzUtcSsrdkwF3eoYzC0hlkyc7a0GnoOvAgaf278CFXcxQKO9qj8ggKRE dolEz3LzOa9vJ4XLQMRq/OC+E2g2ngAL1ZDrJWgWWG3DDk2OpuAsv+t9H7skvwZJxfuG htyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469634; x=1705074434; 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=foPbRN9kgz3ubIukCDMoVcakJKSu99lNJLUQRej2Dsg=; b=AYBWjTv2WOVeTbjsp0IL+3uy3VlAwnoXFSsKl8tr7yj29aWJGjEcwwui1IDaLEUc8F TFuMja47zyNBShc0s93HDyXLsLn83f2rNnwfchaGvcLbWadX9b+8e0Jgy1wc8+MW6G94 M7wUlpciROWugSKi4LKwAFFyZFC7LIWB88cBgjTLFJ+gE70yLquKncjP4q71BMpe9Vl0 b03SW56QZB/6aHfrG3BxglxS8Jw/ancUFyc4iYaGciwIz30rfnE6NkWR7LAN7wh+oDEr bOlCsZNpOgbnrN7zma6z9KKuCmJCDcHrxfRlKEsIXj1X3yd1f/FGsXesxvKHYzmMxqel D4jw== X-Gm-Message-State: AOJu0YydBaZuhR5jcHE43LVwZ2pKJchD7QP6GSteBwPBF4V/FribfeA/ DTwtw+yU7Lvk43zJjwk/QBbUiE8TcBcrhPp0RPepPjlZ9ss= X-Received: by 2002:a5d:550d:0:b0:332:e667:4277 with SMTP id b13-20020a5d550d000000b00332e6674277mr1265526wrv.40.1704469634427; Fri, 05 Jan 2024 07:47:14 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id g18-20020adfa492000000b003365f5e87f4sm1623391wrb.95.2024.01.05.07.47.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:14 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Fabiano Rosas , Gerd Hoffmann Subject: [PULL 37/71] hw/audio/sb16: Do not migrate qdev properties Date: Fri, 5 Jan 2024 16:42:30 +0100 Message-ID: <20240105154307.21385-38-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since commit f7b4f61f63 ("qdev/isa: convert soundblaster") these fields have been converted to qdev properties, so don't need to be migrated: static Property sb16_properties[] = { DEFINE_AUDIO_PROPERTIES(SB16State, card), DEFINE_PROP_UINT32 ("version", SB16State, ver, 0x0405), /* 4.5 */ DEFINE_PROP_UINT32 ("iobase", SB16State, port, 0x220), DEFINE_PROP_UINT32 ("irq", SB16State, irq, 5), DEFINE_PROP_UINT32 ("dma", SB16State, dma, 1), DEFINE_PROP_UINT32 ("dma16", SB16State, hdma, 5), DEFINE_PROP_END_OF_LIST (), }; Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Fabiano Rosas Message-Id: <20231124182615.94943-1-philmd@linaro.org> --- hw/audio/sb16.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c index bf7f35a42b..fd76e78d18 100644 --- a/hw/audio/sb16.c +++ b/hw/audio/sb16.c @@ -1325,11 +1325,11 @@ static const VMStateDescription vmstate_sb16 = { .minimum_version_id = 1, .post_load = sb16_post_load, .fields = (const VMStateField[]) { - VMSTATE_UINT32 (irq, SB16State), - VMSTATE_UINT32 (dma, SB16State), - VMSTATE_UINT32 (hdma, SB16State), - VMSTATE_UINT32 (port, SB16State), - VMSTATE_UINT32 (ver, SB16State), + VMSTATE_UNUSED( 4 /* irq */ + + 4 /* dma */ + + 4 /* hdma */ + + 4 /* port */ + + 4 /* ver */), VMSTATE_INT32 (in_index, SB16State), VMSTATE_INT32 (out_data_len, SB16State), VMSTATE_INT32 (fmt_stereo, SB16State), From patchwork Fri Jan 5 15:42:31 2024 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: 760188 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107048wru; Fri, 5 Jan 2024 07:52:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGICCWBl5TH5aOEmFloIPvHIYNGQJU9tqfZI6nCiBRaHD38yE7cS4lUtQcT8uY6spqFC8uC X-Received: by 2002:a05:6902:dca:b0:dbd:afa2:e9c8 with SMTP id de10-20020a0569020dca00b00dbdafa2e9c8mr2284736ybb.48.1704469940160; Fri, 05 Jan 2024 07:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469940; cv=none; d=google.com; s=arc-20160816; b=Y/yIwbdF+rFqJR/axUKasWKObASmljA2JEjO96ayqeeKwmfC3y5l0dHhIKOre23IQU UWTvIEawLUifAplGH7hksbMhrTcPbLeBLstiSj8AMTOsCfQmj/06b/dbzqg7zQstkKa9 MktNTrfmOXEBOTIqEJ5nRPuLoF9iqYEROMaXOvS+GoEdJto/r7pYqo+BR/udO8HFuHIb 3CAjTQiif+o278oWYDcbMM7DON9/QlyV2OWC7wD4iTdlbGDX/Ttvfs4Hi/BY92VB8wRc po+IaTypN2ExmWHGPkwjBBPE62ibhzshUvVteDRdRK11u1lQbgKCcJBiYIdfwKn3Baoh T2ag== 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=iQqVZQAplGXwt087ddAaGknca/07pmUL/gFu1d2+27U=; fh=cQ2FfVt2/IZC0ZMISg8I4sbY1PJjpClPDf1skqRY4EQ=; b=munxwtsmJx/i4TUBDy70GN1w5SBoq2l3NsijfkVRwbh1vVuacPtxazqNaN3e72Pw7v v/7EOshredjKxSoGMr9q08CQGJjqQsHNJOLwQT1VI44MYBkpkxzwTyL84wYa09zs6o5X o9IYLxLpn8C5kvxkzPyH+tCt9sLrWffbh+/b6WjdhM/YP8QD78to4JJKxAJh8+SD/3B6 nhbY5c29YdUEZe5l8GAa5Y0MdDUjGuvaapnxwD2dypORMlwiLTWQBIQwX437zOwEasDi YsgLMxJVQeewUWY+OcHNCZ/bPlu7kRbI8IMSQUD0/ulaojpCmynl1vVfiX67OJD36JND iz7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rBQ6eBIX; 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 d5-20020a0ce445000000b0067f29a19dd9si2051705qvm.120.2024.01.05.07.52.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52: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=rBQ6eBIX; 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 1rLmR8-0002yi-9b; Fri, 05 Jan 2024 10:48:42 -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 1rLmPs-0005aC-EP for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:26 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmPp-00047Y-M3 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:23 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-336c9acec03so1301787f8f.2 for ; Fri, 05 Jan 2024 07:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469640; x=1705074440; darn=nongnu.org; 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=iQqVZQAplGXwt087ddAaGknca/07pmUL/gFu1d2+27U=; b=rBQ6eBIXuAdfLu0GR0eKsWS8Azq3u6wuQt/JBZFPQA+UTw1BKa/4aqxs2MlLyDkxHa Dmybi4K6P90/kCOiGPp2usL4/dwMPfcqH+zZrUDqv3EyikR2zLsQtZHQE3qbcDGAOmEa wPZKoWXBjmPDfeF6OMULLPtdOE8ukQJD5SuD+86lD1MMo17Fgj7aIHczzKJvC9Jr14WL jnYu6MaFy2xKM7Ur1xTqjl1flVigApzvxBjIEOCWe1GaOlid4kY9wYAi6XpqqOhpODW0 qyE9bL84xhawbACVPZSv2pzucEcTBZyYN8JEHUn1LA/5cPTOtZmhjD/1VlzqX1o2xpgN wgWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469640; x=1705074440; 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=iQqVZQAplGXwt087ddAaGknca/07pmUL/gFu1d2+27U=; b=cv0M0dn3MvBN4A3+Hwny/QXkneNYOcbGf/Aqrm4EJnrGXEZlzriF3XHHharf0O5J17 gX4gFoo5Q3xvvVogg9XC8+55P6AJpjwZsIclJ3Tfxy6v4XyCr6BKXPTq2R45ejk+Wt98 E8oTAEiz3rtvFt1auGhexlZ9804Hm1bMwavlcHhPCFLw2sAXQZr3hH8AZ/3YxqmVsP6h Klr0pwAP82JX1y11bDou+rg2rKQZ814UyIDd0BF3+vO4OCf5LMGrLoKJppZ4a5KPzoMf 2/xlW3xKUqnafnQZBAmsVq0bc6qYfTh/44HYRsJw9fk8isKyZeGsm+QnwcZvNGZCiViX ABmw== X-Gm-Message-State: AOJu0YxcAj8RpkPVR029E5ler4izx+50aD4eIsjO8Fym5W9pqUPc4gjS eb90Y+yno/YViFzi9rvf74HGVjuYEQ9ioL5YylNcG3Zrezk= X-Received: by 2002:adf:ed8c:0:b0:337:d82:5106 with SMTP id c12-20020adfed8c000000b003370d825106mr1218971wro.99.1704469639779; Fri, 05 Jan 2024 07:47:19 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id k7-20020a5d6d47000000b0033725783839sm1605061wri.110.2024.01.05.07.47.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:19 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell Subject: [PULL 38/71] hw/arm/bcm2836: Simplify use of 'reset-cbar' property Date: Fri, 5 Jan 2024 16:42:31 +0100 Message-ID: <20240105154307.21385-39-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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, T_SCC_BODY_TEXT_LINE=-0.01 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 bcm2836_realize() is called by - bcm2836_class_init() which sets: bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a7") - bcm2837_class_init() which sets: bc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a53") Both Cortex-A7 / A53 have the ARM_FEATURE_CBAR set. If it isn't, then this is a programming error: use &error_abort. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20231123143813.42632-3-philmd@linaro.org> --- hw/arm/bcm2836.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 166dc896c0..a1bd1406e1 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -131,10 +131,8 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) s->cpu[n].core.mp_affinity = (bc->clusterid << 8) | n; /* set periphbase/CBAR value for CPU-local registers */ - if (!object_property_set_int(OBJECT(&s->cpu[n].core), "reset-cbar", - bc->peri_base, errp)) { - return; - } + object_property_set_int(OBJECT(&s->cpu[n].core), "reset-cbar", + bc->peri_base, &error_abort); /* start powered off if not enabled */ if (!object_property_set_bool(OBJECT(&s->cpu[n].core), From patchwork Fri Jan 5 15:42:32 2024 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: 760218 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109390wru; Fri, 5 Jan 2024 07:58:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYHhPA44EsElejoyHVSwVCuiPyk6BcvS5VdRzI2OfcSJ8GZXS5PRQTOfV0SLiYH/M+8hkQ X-Received: by 2002:a05:620a:36e2:b0:781:777c:32a1 with SMTP id cz34-20020a05620a36e200b00781777c32a1mr2278955qkb.89.1704470281066; Fri, 05 Jan 2024 07:58:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470281; cv=none; d=google.com; s=arc-20160816; b=Up4ymKsWtltQEFjbNW5OoXPsHIt1TVkjW2v3MNNwjZu6fhkaR5ZPupY5Ftq6IgCIlQ jJ7ARsC5goXvmrKXw9Z8zb5xEQ6kIWl9yz8zlpei49vEI6MCoYDcemyeoNSzBxrYHnPf iJ9BNTM+pAxevNDEvSq1TlU9A+1VpQnzOkJdolJgdUlyhHa+05uMlRdvXPGz4xAKMe0C Dzwg1YsFAYKFlA58JAFRgXNhNi36NZ4Wz+fauKz+CnK1KXtpolZxJ16uQl5Pa2GHNeNb YN6LvrDj66loyJMhEUGqeZZsun7fdeP5c9pxEnyVjm8c9074+iQ01UnPQPp2PXuDllSj uvJg== 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=QIi494ZIPpClTlGLpiqU0qCpof/tLsTarUcBXXHQbq8=; fh=cQ2FfVt2/IZC0ZMISg8I4sbY1PJjpClPDf1skqRY4EQ=; b=KGGTkhzDevz6jcW2Iio0ptCO7CMU3Rh9tkpYho4P2GPkcm1Z4/EZCgsDsqdRJ+mkZ3 ccRMBqsOQ3A9LT8O2wWUtHBRwEqhPSIvOumO+jcMUkj03oogZg7uWryV4+J4cvzV1lrI IUus87iS6q+/64iHTDS2jfE+VqHUmQsBaGXTlyPPChAw7BYlBWdL9gNjBOE8NQQUybJW g2lcmjpRiq9wQrUaaWabOYHGProCd5b30Bsfh7/05L8af78WmmWE454NAtbA78JCPTW6 Uxwz5PxIXbTIQEkEFrVJSIvoKZpAZoSZao0GX59TI0u6gnEu2q8R/NOpnuB5U1KCkvEu aykg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vF/Df9YL"; 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 d16-20020a05620a241000b007815c45ce72si2156486qkn.308.2024.01.05.07.58.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:58:01 -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="vF/Df9YL"; 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 1rLmR6-0002pI-IY; Fri, 05 Jan 2024 10:48: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 1rLmPx-0005yh-Go for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:29 -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 1rLmPu-00048O-Dc for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:29 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40e37524fafso8947865e9.1 for ; Fri, 05 Jan 2024 07:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469645; x=1705074445; darn=nongnu.org; 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=QIi494ZIPpClTlGLpiqU0qCpof/tLsTarUcBXXHQbq8=; b=vF/Df9YLbCjANguPuSTnr5QfBzVSnVUxQLKWNRIi39PkE0VqwfoMXZwtY6i9ev2Y3G k1c044BErpcFaMnnVAmS27oU/FYDSUs/07xVVhlVDTcgiZRasF7PxTLhn0nhwQzRYJjF P9wnNG/gEJPshWBVVLfQpz3KqP4AQyeL1SUIkhYQ+igni1G5atHybX1NltpzRDGmE5kG tXsgdGji5hVH79JHmL9/7/qXTDl6d3Hhy8kVx3KxRmZ52OlbqNGD89B/rVuN3ZFeWJHj T2qVhc50YHGebsufMNlPCQzVCGLbFHERMejo+B43BAYGIjLgjXmRM0Oigxac2DKatPhX Y0FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469645; x=1705074445; 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=QIi494ZIPpClTlGLpiqU0qCpof/tLsTarUcBXXHQbq8=; b=KpeGe8Zm2kiv1NDKB5IOduVkuWvvC/izIbntfphkxc8Vqc8zxzIjatQqC6W/XsLSxx xR9EMjLECeC0XzflYxa/nIyl6pHK1lTj9NCh7vsNOnbA4K4kb5N/iEuwX+wqnKG8XEhP xjxp/0mV1vIzzUR8AaTggs4Dqjbb+WyxlAYfn6wBk+rWmJZnmM6N9QcBHaJIyAgpNioe gVxsH86c6XYZy3ABn1AnWvYqyAWb6cpphm+50ULXCJW4FuX+nJt8el3OKBeInW2Ob0yz CYKY75JNJJdMY9nBEQvaNAG4Hr+FgctVdy3EOar1OXI7rPsB4qVE0d51xu+C/oiMcqbz a0Xw== X-Gm-Message-State: AOJu0YwrvIrUr8CpLZpbvdQNGvI3hEOr6EVN5XsiOe11dj/CzPC/c2Px 1e9PVSUbdyRs9KymDmsT1tG6chmr13GKwDEM/3keJz9T59Q= X-Received: by 2002:a05:600c:4f02:b0:40b:5e21:ec3f with SMTP id l2-20020a05600c4f0200b0040b5e21ec3fmr1175525wmq.113.1704469644973; Fri, 05 Jan 2024 07:47:24 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id iv20-20020a05600c549400b0040b3d8907fesm1928352wmb.29.2024.01.05.07.47.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell Subject: [PULL 39/71] hw/arm/bcm2836: Use ARM_CPU 'mp-affinity' property Date: Fri, 5 Jan 2024 16:42:32 +0100 Message-ID: <20240105154307.21385-40-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 The 'mp-affinity' property is present since commit 15a21fe028 ("target-arm: Add mp-affinity property for ARM CPU class"). Use it and remove a /* TODO */ comment. Since all ARM CPUs have this property, use &error_abort, because this call can not fail. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20231123143813.42632-4-philmd@linaro.org> --- hw/arm/bcm2836.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index a1bd1406e1..289c30e6b6 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -127,8 +127,8 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) qdev_get_gpio_in_named(DEVICE(&s->control), "gpu-fiq", 0)); for (n = 0; n < BCM283X_NCPUS; n++) { - /* TODO: this should be converted to a property of ARM_CPU */ - s->cpu[n].core.mp_affinity = (bc->clusterid << 8) | n; + object_property_set_int(OBJECT(&s->cpu[n].core), "mp-affinity", + (bc->clusterid << 8) | n, &error_abort); /* set periphbase/CBAR value for CPU-local registers */ object_property_set_int(OBJECT(&s->cpu[n].core), "reset-cbar", From patchwork Fri Jan 5 15:42:33 2024 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: 760183 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106231wru; Fri, 5 Jan 2024 07:50:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IHztkIA6gNIt2Ru8X/kKX1fc/MlRxHJBeVnOtjQZYvyUIuhd0GE8uqAdFQMjyzMm1yFZ4B5 X-Received: by 2002:a05:6870:944f:b0:1fb:75b:2fab with SMTP id e15-20020a056870944f00b001fb075b2fabmr2305722oal.66.1704469822561; Fri, 05 Jan 2024 07:50:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469822; cv=none; d=google.com; s=arc-20160816; b=zUlnoiPzq7fkU8Zc0nwsRdV03HCMRsBKmWxdweC5U8XpmCU4IGwkRz6qufyOSB0Hav RoIHDJNpAoXy5F8CHptkpllaTttyixURoJG9F1G8yvNSvbhDUIbCD/gI6HS66exxl8IJ ETQX7KCNtNF2Z/61x7BTlfWrio44kQp+Cz05AJiqxwXK7ZuyY4CZMYp05H2CTDKAszb2 tQv5dCmsdPEC/zIiko6GicHSkEEqO73b9+nhSy/bqhru9zYy/S2R/7ZbdRK1IcU1RHnX GrxuqMmhuzdMdkCNWYGolCl7qyEms82rant8C+9KH5o79uFmlDvUeWpZvvI3xLWcsDKX 3d5g== 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=3QQ/o8R5/vZPDmg4xKxtglyBmLRK3vBkRVa+vx66Ggc=; fh=rkt+9HaXwNBmvup87LLu9yZu5jcNyziDIhsNC7dj/wk=; b=tA/sBOPhmw6sCtQ9jzRereru1uote0JsNVqzGJVDcp/v0NVcLu9fvpIGNlAjDIRxgL 4qTo6OaZWSJYQb5rDO8EhxYSDInpIr+zOwTfPslQe9/KPi7UvHSi2h3pD167fp8RcuNR KTKlW/iB2wZz7qSsVBIWa7ZS3D8QouXbrUry71yzgzHFE2QkTOrim7hI8lIeh3giwYn+ 2cLz8gVPYVrL7/ajTS8+FoYdUp8SPP97GnmlvvudEmMkhhjv8kDFD8aJDvYEO2CiYLCd uQNm/E1ZsmVGCHpxdDOI6mK7rwGBUC2Usm2UOJ2y/ob+y2T145R5IjeXoqp62xBZvx+e 9O+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gzNgdQPX; 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 j7-20020a05620a410700b0078309d199basi1369065qko.634.2024.01.05.07.50.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:50:22 -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=gzNgdQPX; 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 1rLmRF-0003re-6J; Fri, 05 Jan 2024 10:48: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 1rLmQ3-0006db-QB for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:36 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmQ1-0004Fv-9S for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:35 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-40d2e56f3a6so4032425e9.1 for ; Fri, 05 Jan 2024 07:47:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469650; x=1705074450; darn=nongnu.org; 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=3QQ/o8R5/vZPDmg4xKxtglyBmLRK3vBkRVa+vx66Ggc=; b=gzNgdQPXPyjo0e59+p2+dOCfBNfxyuQQCVoz1hYTsUQgktONxBoVkdqtkzt2RqWLX0 UphElLe0/bONr7wFZY77YWN/JtT49wtgD3wopOUbKNxq818eaLpq04F28C5XYAyVEEDv 4KymZ7QFi3RxRWrHaKFSscJ4lGAuUQVfqTz7cajRwr+b3zxWpIaNt5A+H0FpClFs/tlK vLlzlloKi87hyq0XFqCBZW65CQNFnJq7Y2blXFKtOcZ1Q8ujbyjZJgazTpGvA7NihO+8 drOCpcCrZDE8Vs8YiKYiq+dvTYLaDkjkvjtncRRMbmtPF7N/lXgZBcsX8Tuhts15qdCn Tgqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469650; x=1705074450; 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=3QQ/o8R5/vZPDmg4xKxtglyBmLRK3vBkRVa+vx66Ggc=; b=g5Ge2VmNG8Wbs8s9aPIYopu4ZGS4rgGx66DX9Ggmuy/kE4MFOh+mPmXTwvQeEm4AzL ipLRxU9pph0QMrGN+bouop0i/Qj3imo8bxLbyNLsbsyZoeoFluLuLLegLrCjgri4WZqb tnS7MA0EM0zj1sgMbhc2W+dO9JCNrfv7lGLQHFa8G6MmuiHt09Lqvnc5ww08LOtvJwBy DdbMAed8vDqz+mopEJxXvEUJYc4PJbG+ogpKC7BWvebOj7H1sRK2idUcWA2e1EImHmMn x+e58JUeb1LFinJPKtBy5+o8c9gIZv/x/iu0du9acvDqVnenXA7+GLvPPO9vvq6MfgxP jyiw== X-Gm-Message-State: AOJu0Yy3aB1ZRRAHAMZrTXTMszQeAJPRBQm1wiW5eM2rlbLrfTLWeqnM grmSnSVy11rm/1/NlZCvi6t8cg4av10onOFA9m5TRM+EDZ8= X-Received: by 2002:a05:600c:3112:b0:40d:62f7:3097 with SMTP id g18-20020a05600c311200b0040d62f73097mr1318661wmo.130.1704469650602; Fri, 05 Jan 2024 07:47:30 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id cx12-20020a056000092c00b00336b702af06sm1613139wrb.16.2024.01.05.07.47.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Harsh Prateek Bora , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , David Gibson Subject: [PULL 40/71] hw/ppc/spapr_cpu_core: Access QDev properties with proper API Date: Fri, 5 Jan 2024 16:42:33 +0100 Message-ID: <20240105154307.21385-41-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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, T_SCC_BODY_TEXT_LINE=-0.01 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 CPUState::start_powered_off field is part of the internal implementation of a QDev CPU. It is exposed as the QDev "start-powered-off" property. External components should use the qdev properties API to access it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Harsh Prateek Bora Message-Id: <20231123143813.42632-2-philmd@linaro.org> --- hw/ppc/spapr_cpu_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 710078e9f7..5aa1ed474a 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -306,7 +306,7 @@ static PowerPCCPU *spapr_create_vcpu(SpaprCpuCore *sc, int i, Error **errp) * All CPUs start halted. CPU0 is unhalted from the machine level reset code * and the rest are explicitly started up by the guest using an RTAS call. */ - cs->start_powered_off = true; + qdev_prop_set_bit(DEVICE(obj), "start-powered-off", true); cs->cpu_index = cc->core_id + i; if (!spapr_set_vcpu_id(cpu, cs->cpu_index, errp)) { return NULL; From patchwork Fri Jan 5 15:42:34 2024 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: 760223 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp111356wru; Fri, 5 Jan 2024 08:01:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/Kjzz8KZazWVcHAFwZh3ikM8xhoNOLa5/DttQCuv/Tig0SejEtHHOFH5K1b/Rp0oyGbx8 X-Received: by 2002:a05:620a:4141:b0:783:672:3483 with SMTP id k1-20020a05620a414100b0078306723483mr1943277qko.88.1704470499280; Fri, 05 Jan 2024 08:01:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470499; cv=none; d=google.com; s=arc-20160816; b=MtTgDi7H/7KKmujrl1/ylpW6cvGzdonX+3HcoA1dnKB3+vGaYYeylHcM5lMY55EmNO GMG+uhu6JRtrmfjhsRzWthxkwd2IoKFNld+ZvEfMy3tTd0KMfdCp4aiMBKozPqcTk1AS ajTra4fxGk3niChcKQVd/mApAOYOdy3eYE8Rvr7J6Ar7ymjlRskst3qetNOPtA9wG3ze zwEAAl6hAb/XXnTfDl2UWQEf7vH5Oic2l2/+hj0b5+tspdcfoounlJW3uLCQgnwpcn7q TC7QOV3ZLld2u1HwqVQP7hWeNRqiNE8QOzaXbZmasdsowkOMEajOHzMUxsshOFZmj3ez b+7w== 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=E6gZ5WhughGxcVou1a2gSnMeSMbcizgPZgg8bhDFRA4=; fh=D8rzsyW32sL0F4dymhcQ/+RJwDoO/kXyRKYDrO0pbQc=; b=ZbBkRcE14O/0HloQ9TZzUmhMAJfd6grg22GLoGH/iWAAIHbe+zIMK13jniWVq2G5PU M4mXOKmnYAptAV5w5UFn3SWOB4neHEw2Iw+zjQxvVadefihumvgbw3SU3IFOVk3/x6cm Y/Y9OxRQsA8nrxIs8qFIVESFNm4R+tEKSDDncWLp+rG7YNh/2Iq7g6vhb6Xjiv6pv/w7 4vB2e42MLyzt9GwISjrfFDXM63gJZi4H/wA4uTQTDhb5VRTFdilRtokdGTaaMszml5Vz +mX/1jGC5UmTnZKKRm541mRkQgFS7D5oemwaQO9v11Au520TGf1aZJ1hqMh3Av+OFgtH oOhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qhcaafY2; 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 h11-20020a05620a284b00b007815c65c8c1si2169767qkp.65.2024.01.05.08.01.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 08:01:39 -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=qhcaafY2; 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 1rLmRK-0004VA-1r; Fri, 05 Jan 2024 10:48:54 -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 1rLmQB-000746-1V for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:43 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmQ5-0004QO-US for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:41 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40e3b3fb6f6so1877005e9.2 for ; Fri, 05 Jan 2024 07:47:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469656; x=1705074456; darn=nongnu.org; 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=E6gZ5WhughGxcVou1a2gSnMeSMbcizgPZgg8bhDFRA4=; b=qhcaafY2wK1cDcfgx5MrK949O89dJJEHfaQa9rTTbysHcJivO4WmkmbPTEOpwWr1KW bHoD76itI+sdJQQq0quf06rpAZAXn7iIKB6AGPG5kNteKAlt2gTcuZ7j17SXBn0gNPgi XC672JaKdTfiLUxN6QN7+uLrDp5XY63k5w+yW1EVQTJzOFtvJOQpOFsy5OSpaiXEsYni 2wIIjeTvG5gUym1imHNTTxcSvA28AHDMjwn84XNdmZ6ekAGz8855I7D9oRxmYUUoKsg8 ZzVc7jYbFLh+zQ3PklsjDjbVsEmX1fHTfgvtbwtCreTeIH11At5HFulLf67+WoiTpNZh x+XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469656; x=1705074456; 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=E6gZ5WhughGxcVou1a2gSnMeSMbcizgPZgg8bhDFRA4=; b=EWFkGLf6M5a2nBr9YtpXdI7LCC/Q6wUOSNV2C5Fqlpnmi668Q0k5wo05X6NZ1GarPc 6OxxA+Ol3a3IJjfY+oZi7nxnDg68lmp7MBs4yF6usYc/NVAIUyy8/G7nTqm2mGVwgiVx BO5xVUFHtSsZKJYFJB0d2SxrlP7PjGu0K92PqM1okdZm8alD9deSFQIXBNpPKm/2cb0c Q68AEB4FWN/Ojs9rmjr+3HXgLcLclg1WWWqsQTWsUldklVcxy+gVI+OUY3M7618YI+ta +3Vn7XmQkn23v7uZPgSlO0UW7+GqjdW1XKVhj255iJf13WrrAD2fTGY1FHifsenDWHYg OUOQ== X-Gm-Message-State: AOJu0YwvbDAcb9X7vR92HJz8niTkFxe36YRF450lSt1qfDr79HV3f3Dh Vrem9W4yK7JSKCazRrkpOdEmbqmHsNj/00JVO9a78ZRJ0Ao= X-Received: by 2002:a1c:4b10:0:b0:40d:8810:620c with SMTP id y16-20020a1c4b10000000b0040d8810620cmr1318587wma.52.1704469656069; Fri, 05 Jan 2024 07:47:36 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id t9-20020a05600c198900b0040d6d755c90sm1933844wmq.42.2024.01.05.07.47.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Peter Maydell , Mark Cave-Ayland , Artyom Tarasenko Subject: [PULL 41/71] hw: Simplify accesses to the CPUState::'start-powered-off' property Date: Fri, 5 Jan 2024 16:42:34 +0100 Message-ID: <20240105154307.21385-42-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 The 'start-powered-off' property has been added to ARM CPUs in commit 5de164304a ("arm: Allow secondary KVM CPUs to be booted via PSCI"), then eventually got generalized to all CPUs in commit c1b701587e ("target/arm: Move start-powered-off property to generic CPUState"). Since all CPUs have it, no need to check whether it is available. Updating this property can't fail, so use &error_abort. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20231123143813.42632-5-philmd@linaro.org> --- hw/arm/armsse.c | 6 ++---- hw/arm/armv7m.c | 8 ++------ hw/arm/bcm2836.c | 8 ++------ hw/mips/cps.c | 7 +++---- hw/ppc/e500.c | 2 +- hw/sparc/sun4m.c | 2 +- 6 files changed, 11 insertions(+), 22 deletions(-) diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index 02b4f6596f..91502d157a 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -1022,10 +1022,8 @@ static void armsse_realize(DeviceState *dev, Error **errp) * later if necessary. */ if (extract32(info->cpuwait_rst, i, 1)) { - if (!object_property_set_bool(cpuobj, "start-powered-off", true, - errp)) { - return; - } + object_property_set_bool(cpuobj, "start-powered-off", true, + &error_abort); } if (!s->cpu_fpu[i]) { if (!object_property_set_bool(cpuobj, "vfp", false, errp)) { diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c index 375a40962f..e39b61bc1a 100644 --- a/hw/arm/armv7m.c +++ b/hw/arm/armv7m.c @@ -318,12 +318,6 @@ static void armv7m_realize(DeviceState *dev, Error **errp) return; } } - if (object_property_find(OBJECT(s->cpu), "start-powered-off")) { - if (!object_property_set_bool(OBJECT(s->cpu), "start-powered-off", - s->start_powered_off, errp)) { - return; - } - } if (object_property_find(OBJECT(s->cpu), "vfp")) { if (!object_property_set_bool(OBJECT(s->cpu), "vfp", s->vfp, errp)) { return; @@ -334,6 +328,8 @@ static void armv7m_realize(DeviceState *dev, Error **errp) return; } } + object_property_set_bool(OBJECT(s->cpu), "start-powered-off", + s->start_powered_off, &error_abort); /* * Real M-profile hardware can be configured with a different number of diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 289c30e6b6..b0674a22a6 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -135,12 +135,8 @@ static void bcm2836_realize(DeviceState *dev, Error **errp) bc->peri_base, &error_abort); /* start powered off if not enabled */ - if (!object_property_set_bool(OBJECT(&s->cpu[n].core), - "start-powered-off", - n >= s->enabled_cpus, - errp)) { - return; - } + object_property_set_bool(OBJECT(&s->cpu[n].core), "start-powered-off", + n >= s->enabled_cpus, &error_abort); if (!qdev_realize(DEVICE(&s->cpu[n].core), NULL, errp)) { return; diff --git a/hw/mips/cps.c b/hw/mips/cps.c index b6612c1762..4f12e23ab5 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -78,10 +78,9 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) 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, - errp)) { - return; - } + object_property_set_bool(OBJECT(cpu), "start-powered-off", true, + &error_abort); + /* All cores use the same clock tree */ qdev_connect_clock_in(DEVICE(cpu), "clk-in", s->clock); diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 384226296b..566f1200dd 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -955,7 +955,7 @@ void ppce500_init(MachineState *machine) * when implementing non-kernel boot. */ object_property_set_bool(OBJECT(cs), "start-powered-off", i != 0, - &error_fatal); + &error_abort); qdev_realize_and_unref(DEVICE(cs), NULL, &error_fatal); if (!firstenv) { diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 17bf5f2879..64895aebe3 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -804,7 +804,7 @@ static void cpu_devinit(const char *cpu_type, unsigned int id, qemu_register_reset(sun4m_cpu_reset, cpu); object_property_set_bool(OBJECT(cpu), "start-powered-off", id != 0, - &error_fatal); + &error_abort); qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal); cpu_sparc_set_id(env, id); *cpu_irqs = qemu_allocate_irqs(cpu_set_irq, cpu, MAX_PILS); From patchwork Fri Jan 5 15:42:35 2024 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: 760178 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp105814wru; Fri, 5 Jan 2024 07:49:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHAw3PboG/hLblingA7Kn0PRVLb3KM73k5u1MdaYpb0C9NDAVT36bRPcnyaWUVjveQ5ggur X-Received: by 2002:a05:620a:c13:b0:781:ced5:cb96 with SMTP id l19-20020a05620a0c1300b00781ced5cb96mr2185904qki.58.1704469766650; Fri, 05 Jan 2024 07:49:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469766; cv=none; d=google.com; s=arc-20160816; b=FedWQyLvGx93Esw2t8kcnTEY8K1aGsghnf3keI+KpX3MfYapajMoMSunGyuMusN1FT ZWfokG3wmYC9hfugf0bptmM0VVImYIe4oJMEryzilj/fMvDrQDgUkO6KxfKTbgmHcqHj VNEk3t3IAjJECbJ2HwhEdqVfYhMakozy6Jz+/RC8rPcWBaC46d+pQCzq8XUTQRNLTtRO 6WNYib/tiWzfpocxhxuLt/s9TIUsM6eOW9jxKiwS6XrkQySpU4gXVclGoOYREdQyf4O3 KnOEObh85SdKf/YwXD1Dn88AQSkO224K0HFUkQSMKOmkBmk0EMGUw+BiLbVe/e9LFSqI 67bg== 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=MxNkugF37b5fEcbJO0/Zfbyy2DcJjrIhzRUUZIZhOZ4=; fh=RHvafWDgpoEf3dpMj/nX1s5Lj/g1hoSh/j4YvQR2jco=; b=dpYPeV10pONQLSvf5c/l+wlVWu+JedpYKvICN7GnyJc8OXCE6t44KbZPBzH6gzStJI sD+Nr3/tb/E6IGrsOE98xfGMhpPzRY4yF+e0PIizvNrKOLc/5gN9uQypGA41ORCbzLKS pMbtOfLhQjMxiSTifXG1K+7IHVHun4GQVk6Dp4bXhuupZJKlHVutbZpa4tVZnYtklDgL nDpiCtQP+M3CF51hBlVl2VuoKNlYM75YEFdyIadCG6tStIiOGZMU6flV0S3htDKvs/86 CuEmEOOXnE306PIm5rBSpBhj7F6raHadu225NTqz2ypTr9gqlU5sEq5UH1JpoztmWia8 V2RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yYLmrPiF; 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 bq20-20020a05620a469400b007815ba075f6si1979584qkb.310.2024.01.05.07.49.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:49:26 -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=yYLmrPiF; 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 1rLmR4-0002YA-Mb; Fri, 05 Jan 2024 10:48:38 -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 1rLmQE-0007VR-6B for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:47 -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 1rLmQB-0004R6-3U for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:45 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40d2e56f3a6so4035035e9.1 for ; Fri, 05 Jan 2024 07:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469661; x=1705074461; darn=nongnu.org; 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=MxNkugF37b5fEcbJO0/Zfbyy2DcJjrIhzRUUZIZhOZ4=; b=yYLmrPiFphG60m57lWmC4wzmjjC5wVNp3yXqvYn5hD2n/4yIBy7JfY251rW0btPeVh K8jX2XUEbDcJJsBNOYaM33TPegWCZy6Db1d2U7ge6EKZQ6H9yhtAPOwYGJJrwdWAdDyJ SSksFTsyvOlezel6aiee7zY+Pfsf0aDX4C0W2Aa4/J9dgq96kepL0zHsxZC7lcN3bpNM ZuxqOz63Yr5gIr/EuCp6YDRSBvOFOVcf1FVuneMfxkwwqxVxLi3W5PXHJPtpW6Cbidis 9xLUSHsHjlTeVj4cJIb5Hhg1xKaJFikrm/5YS773otLAsL4Yt7do9EUMZoHQJZI3ocj7 uFJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469661; x=1705074461; 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=MxNkugF37b5fEcbJO0/Zfbyy2DcJjrIhzRUUZIZhOZ4=; b=VfE+dowLyZ7XABI5RPTHm5/qm7ffZLTxHv/OcV/XVx6EJwq4qC920DB7HDTC9zmxpJ za0kof+EXDpKj4wNb//DNdYB8RmInNeBkPpOScLq8dfKQVuG7j1b6v0gSrICn/pRVa7y Sw2JIjOrJ+oqdurEE+V9wmpRPi6q8OSM4lLmE4qbhDBX76pxXWFyJ45OYUvppyuYU9h0 70RSVVsK3CtG1It6G+KDNPM48yUtUohke3juBJGYqBDiezbx9dmzidoZ1SMRVrf3P1UQ Bm700qODbjkE/9rWxfdkcNuFHhnFhH+fu3nHBtE/BBrlwP98x67K9Qb3gUVp7hL5wPFN u94w== X-Gm-Message-State: AOJu0Yx8HrEkvJJVjm5C3HJMf56GpAZ4zLSCUfRN4jKCRguj7SkLW2pT ol4SAda6PGMOT8YgSrg+lSysmzcu8JGy8Q3bq4nPPo5JwdU= X-Received: by 2002:a05:600c:1d0a:b0:40d:81bd:9d12 with SMTP id l10-20020a05600c1d0a00b0040d81bd9d12mr1310560wms.147.1704469661441; Fri, 05 Jan 2024 07:47:41 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id q16-20020adfea10000000b003365fcc1846sm1605027wrm.52.2024.01.05.07.47.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , =?utf-8?q?C=C3=A9dric_Le?= =?utf-8?q?_Goater?= , =?utf-8?b?RnLDqWTDqXJpYyBCYXJyYXQ=?= Subject: [PULL 42/71] hw/ppc/xive2_regs: Remove unnecessary 'cpu.h' inclusion Date: Fri, 5 Jan 2024 16:42:35 +0100 Message-ID: <20240105154307.21385-43-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 xive2_regs.h only requires declarations from "qemu/bswap.h". Include it instead of the huge target-specific "cpu.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Message-Id: <20231122183920.17905-1-philmd@linaro.org> --- include/hw/ppc/xive2_regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/ppc/xive2_regs.h b/include/hw/ppc/xive2_regs.h index b7adbdb7b9..816f5d0e84 100644 --- a/include/hw/ppc/xive2_regs.h +++ b/include/hw/ppc/xive2_regs.h @@ -10,7 +10,7 @@ #ifndef PPC_XIVE2_REGS_H #define PPC_XIVE2_REGS_H -#include "cpu.h" +#include "qemu/bswap.h" /* * Thread Interrupt Management Area (TIMA) From patchwork Fri Jan 5 15:42:36 2024 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: 760216 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109162wru; Fri, 5 Jan 2024 07:57:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQoBGfDw4kSLYvPgfw0ukH6lioYOVuYuPKtmvYt8HmFpcyz+Kaz53YggaMGchNpM8DH98F X-Received: by 2002:a05:6214:23cb:b0:680:c762:4795 with SMTP id hr11-20020a05621423cb00b00680c7624795mr2437172qvb.33.1704470244697; Fri, 05 Jan 2024 07:57:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470244; cv=none; d=google.com; s=arc-20160816; b=P9EKct0SZeNmIwEPeNwLQ/7+8S56bc1+H+HVQLUfmdmlvczO/zwDD5Cdji3wQCeRVH GzLehUl+diV4rGQMRFwaUTPMNjjAZG86Gs6qkkpBn8xspJP9ZhBfJwi3ip5+pnZKSdj1 zxHsFmpfYr5vv+neosEINVlTdLnah6TuwQyL0pESfDY090K7JSDMOYW8Dw/Hd9AYqYpm MDA+l2sNcTqx9xONLY3PmEae7P/ppi4Pw8EfJLaPIxadeXVa6we2UbWNh4YwsRY0zeSf S1TAUzX17wYXXSoqjUrKI+5SHrXozTBQARtrC4QwVBZkLvjmE4azLpG+YPqrofAT0tqc bW/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=pzBOft/r+pQ28bPRm3cZUcB0Cj6Ii9RnBaNZcpiqy/g=; fh=S2hnCKcS0eBIA4Fe9+Xpg4dbdBClN+9NwNcCWKpQPaM=; b=lNICPnBIgRqzfIp3OjVwzpU8ywtIGd5sclhuj72pJGpIFdRMnhG16pKJu+I6K1Ct2K RsBVXxMx4ak+UMImucrv6bG+GeB4EG8dlkdy6vBJ51nrSrPnk+rq6kdy/HiGXBkCOb+B yOGBeh8w3ZIByWwSTReDcSbucQIgzq1rR/8IZJV2kCgMxxDUPIbgRbqfFgCDBw18uyBK 8az/CbacWA1d9WU2poGd2bbKq67+9rNB5C5GBGqVUr8XL2pWAF7V+p74VeqZ5iMKtPWe W76rKC34eUt/yLrU78yyAtWbBqqqgTtAK73DUW7XrxnML7nIZ1vYJp/WLETdWH2qHpgm G4Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DC9QmywZ; 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 y19-20020a0cd993000000b0067f60f66a13si2035939qvj.581.2024.01.05.07.57.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:57:24 -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=DC9QmywZ; 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 1rLmRD-0003dI-Ca; Fri, 05 Jan 2024 10:48:47 -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 1rLmQL-000820-Dt for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:53 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmQG-0004mO-I9 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:51 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40d8909a6feso18011475e9.2 for ; Fri, 05 Jan 2024 07:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469667; x=1705074467; darn=nongnu.org; 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=pzBOft/r+pQ28bPRm3cZUcB0Cj6Ii9RnBaNZcpiqy/g=; b=DC9QmywZGIdHeP4Ut5HMMTGn8IGKL3B7RdqJaFqiUeLPUox1E7Hd/jfol0RnJ1MPet aFITvVqau9AxgvptyeESL/Q7BfchVxrLQpkURXUk31PpzwSVRnA2YpfDzc8dolkS/9WR t6kp50tdnRfhi3w4EZMJPRoxOnX/bpBo1vnd4hsiosjRAsUwTlBgcjampXHdEgZ0GfiJ FZICIvyg3jr4JHJkePp7dqzH9CbCVkFORDXpCNpGiCHHlbHueRBCM+0/VzuKhhSG4ALY DkVQSZmpJ1WTJo8LX+mYI7VX+z5lGceL7UeKO2NNQowc1KG6R1ARASFfZW0kP7feZynN WYQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469667; x=1705074467; 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=pzBOft/r+pQ28bPRm3cZUcB0Cj6Ii9RnBaNZcpiqy/g=; b=QQmP5S848pkQCDeenmlP/76HZs6Y3TH9Y0GRPgChP5ERLaYhrlWMqJ7qOxUkR3K5GX +9I8I/f2fBex+O9nnShJs3rhc9yY9b15UhQF6aC3q0b3XBZuZNd/LhRQdUdcx9cs6Zo9 +Bw7/GIZ+QQlMUBKGcEMIR/RUjrzECRIhC56BweLKeVelwNmL5J1Jx2wFWQra86r0kWe Od5wHnvqdn+vV2FP9/kFoTsUVSy9Phh/55IbIHd9i89/T0ppPciX+Nq6lSYiOzOg4H0b fWBsaHv9AUbMjPkdDY20Qu6+Id7TWlzXCi1NRaiMXRaQEeFsSy6u/jUAKCdXVNF7QMTt 01jQ== X-Gm-Message-State: AOJu0YzdK9kZYSbDOiZnpdLflUs5tvmytXyRJAL2ulqkl0jnXe8sbHW2 1biZLFJ7QCdCAav9iyih1NlOUONh5S5H+hEW7Vpir/ki6nM= X-Received: by 2002:a05:600c:c0b:b0:40e:351d:53fd with SMTP id fm11-20020a05600c0c0b00b0040e351d53fdmr848618wmb.239.1704469666949; Fri, 05 Jan 2024 07:47:46 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id v1-20020adfe281000000b003365aa39d30sm1617394wri.11.2024.01.05.07.47.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Herv?= =?utf-8?q?=C3=A9_Poussineau?= , Aleksandar Rikalo , Aurelien Jarno , Jiaxun Yang Subject: [PULL 43/71] hw/mips: Inline 'bios.h' definitions Date: Fri, 5 Jan 2024 16:42:36 +0100 Message-ID: <20240105154307.21385-44-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 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 There is no universal BIOS, each machine needs a specific one. Move the machine-specific definitions to each machine code and remove this bogus header. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20231122184334.18201-1-philmd@linaro.org> --- include/hw/mips/bios.h | 14 -------------- hw/mips/jazz.c | 10 +++++++++- hw/mips/malta.c | 9 ++++++++- hw/mips/mipssim.c | 10 +++++++++- 4 files changed, 26 insertions(+), 17 deletions(-) delete mode 100644 include/hw/mips/bios.h diff --git a/include/hw/mips/bios.h b/include/hw/mips/bios.h deleted file mode 100644 index 44acb6815b..0000000000 --- a/include/hw/mips/bios.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef HW_MIPS_BIOS_H -#define HW_MIPS_BIOS_H - -#include "qemu/units.h" -#include "cpu.h" - -#define BIOS_SIZE (4 * MiB) -#if TARGET_BIG_ENDIAN -#define BIOS_FILENAME "mips_bios.bin" -#else -#define BIOS_FILENAME "mipsel_bios.bin" -#endif - -#endif diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index d33a76ad4d..0d2348aa5a 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -36,7 +36,6 @@ #include "hw/boards.h" #include "net/net.h" #include "hw/scsi/esp.h" -#include "hw/mips/bios.h" #include "hw/loader.h" #include "hw/rtc/mc146818rtc.h" #include "hw/timer/i8254.h" @@ -53,12 +52,19 @@ #ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" #endif /* CONFIG_TCG */ +#include "cpu.h" enum jazz_model_e { JAZZ_MAGNUM, JAZZ_PICA61, }; +#if TARGET_BIG_ENDIAN +#define BIOS_FILENAME "mips_bios.bin" +#else +#define BIOS_FILENAME "mipsel_bios.bin" +#endif + static void main_cpu_reset(void *opaque) { MIPSCPU *cpu = opaque; @@ -147,6 +153,8 @@ static void mips_jazz_init_net(NICInfo *nd, IOMMUMemoryRegion *rc4030_dma_mr, prom[7] = 0xff - checksum; } +#define BIOS_SIZE (4 * MiB) + #define MAGNUM_BIOS_SIZE_MAX 0x7e000 #define MAGNUM_BIOS_SIZE \ (BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 049de46a9e..d22bb1edef 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -40,7 +40,6 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" #include "qemu/log.h" -#include "hw/mips/bios.h" #include "hw/ide/pci.h" #include "hw/irq.h" #include "hw/loader.h" @@ -59,6 +58,7 @@ #include "hw/qdev-clock.h" #include "target/mips/internal.h" #include "trace.h" +#include "cpu.h" #define ENVP_PADDR 0x2000 #define ENVP_VADDR cpu_mips_phys_to_kseg0(NULL, ENVP_PADDR) @@ -71,6 +71,7 @@ #define RESET_ADDRESS 0x1fc00000ULL #define FLASH_SIZE 0x400000 +#define BIOS_SIZE (4 * MiB) #define PIIX4_PCI_DEVFN PCI_DEVFN(10, 0) @@ -91,6 +92,12 @@ typedef struct { bool display_inited; } MaltaFPGAState; +#if TARGET_BIG_ENDIAN +#define BIOS_FILENAME "mips_bios.bin" +#else +#define BIOS_FILENAME "mipsel_bios.bin" +#endif + #define TYPE_MIPS_MALTA "mips-malta" OBJECT_DECLARE_SIMPLE_TYPE(MaltaState, MIPS_MALTA) diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 4f743f37eb..01e323904d 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -35,7 +35,6 @@ #include "net/net.h" #include "sysemu/sysemu.h" #include "hw/boards.h" -#include "hw/mips/bios.h" #include "hw/loader.h" #include "elf.h" #include "hw/sysbus.h" @@ -43,6 +42,15 @@ #include "qemu/error-report.h" #include "sysemu/qtest.h" #include "sysemu/reset.h" +#include "cpu.h" + +#define BIOS_SIZE (4 * MiB) + +#if TARGET_BIG_ENDIAN +#define BIOS_FILENAME "mips_bios.bin" +#else +#define BIOS_FILENAME "mipsel_bios.bin" +#endif static struct _loaderparams { int ram_size; From patchwork Fri Jan 5 15:42:37 2024 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: 760180 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106145wru; Fri, 5 Jan 2024 07:50:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbfqDH7Ah+ghC1+ZdCfJQC3tc2iNoTt0oAD6RXZUtd5Na1LpM9pL4SKBduuOS47/pgNnM3 X-Received: by 2002:ac8:5751:0:b0:429:7b93:3685 with SMTP id 17-20020ac85751000000b004297b933685mr772385qtx.108.1704469812510; Fri, 05 Jan 2024 07:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469812; cv=none; d=google.com; s=arc-20160816; b=XkIgdlrxkweMVKZ3cyal7YMu/TX9bDEo45Z/U8EQTikoQQLbG3Llvrt8omcN3z1OFt F6+FKGIk9OcsvwQLHzj4OYO7Eq2SNKz5lknXPqNwpbqNzdPvXtsA1tRHRjXOkViCuMBn TZuEjZQIGAyd+Qlu9fxsZiTdd9VXnRLRXDDr0hmPpe4b/bJ5JGsR39ih2b6FcNKeGPoK ynWG8YkZAOuEmunvJZ8YfZHq3JSDs5eDrm+6HeJ0ly973AYpzybZxbUUhYIDXvnZVtnW WBVo56NvHdIdwp41qdDg9GFUKAtzB3IG80+hs2YMFwOETRqoksb37mXRnCMTKbMrGmL1 AYOQ== 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=ImxUabCyGAsbEkeWSJUeGE5vK4aQJgpXA7LrF1s1fHM=; fh=ommUZV3lVI8TSdtrCh+lREq94RlB1kCBJbnpVILHDbk=; b=1BTxWoveYFYXzKfUQr4CxKKtcDE8ErCcA2D1j7lx89Yf7liO0wavepH8pNhei4uX64 4HeiWgR7Br0nWKXLtRb5dzSBIMvhGrzoa8xFVMsXysYoNshPSmO7kfZE59dbIhA8rCbh RdXp7ovTcEzZhpbtgrbxi9U2vbh3h00zrVmXd0nK59mN5JiVKuYH+cuxZZLbGLMHeHr4 KVadTfeY3NsrIitTMRuqtZnGehQKL26Y2uMzSmvuvBPLMcECXt7s9pQr+9gOmAKalDBh HTMJTMZTYD9KzNaIKRWYjDms7WNUGgWlZtOA1y3TTZgPCnbCZMTLKCtOkmKwAuZssR8k oMeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oVNdv/uW"; 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 b22-20020ac85bd6000000b0042827cb27e0si2079835qtb.706.2024.01.05.07.50.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:50:12 -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="oVNdv/uW"; 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 1rLmRR-0005Ny-Uz; Fri, 05 Jan 2024 10:49:02 -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 1rLmQP-00088H-27 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:59 -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 1rLmQL-0004uG-QU for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:47:56 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40d5d898162so12849695e9.3 for ; Fri, 05 Jan 2024 07:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469672; x=1705074472; darn=nongnu.org; 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=ImxUabCyGAsbEkeWSJUeGE5vK4aQJgpXA7LrF1s1fHM=; b=oVNdv/uWyOZgf1GY0aF6VlQRLpBiHwoX7YB0A4ap1RtTb/F1bzgUxCpbFhkWVN+9c8 QjGBR2OknXGcGFjboXKq4lrWLmUsqW5GIEk2/K0fiXsR4lGNQtJD2aKbzaSw9IBsps2I Zm8PtmmmYn4FAb42ZA7A50/fzThFEp+xntWu7dRCaQlNEFmAm1eQg0Jlh1GFsXffJYcl FeHo2Kgar8qj9R3knAc4ZSOOEfb5SRHuQhkjbmar5LUqpGmcpNZmppOPIT+8D+g4LUZ/ HWaAWtL65O2AuD/pR0ihX/U3wieCBDdoZEajRoNTHccSgb3LxgAntb105+ZTRUfLiSeU vz4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469672; x=1705074472; 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=ImxUabCyGAsbEkeWSJUeGE5vK4aQJgpXA7LrF1s1fHM=; b=abQOQYE+H8bHTsSKOPIl1Z/AV30Uqo618cHSzMvj/RTlfgKtW9DOrDQLd1r8foU1pM INVi7/6JeKuQnWWVZzDFhMyzsmz0H0ucZt0J+0SmArmfx2hpVrCclsuRqDXQzkEXfq3W awuk7z/esqyza2EX6IbQpjNQGSR86XP5i1flnUgWyquXJ/kpNaIZazVbh0yDR2BIVI2+ 7i39TNPre2pQ1cc+oG1kKNx/sWkkWoNfky1sRISrGn+emUN0IJsiQCZbzzid1RIIp54r 06JUKjtPLL0VGovYei2jDT9BSIxDKX2XA5NFcxazjiAJD7DbFbGpA42CQSNNthwoeYaJ AMGw== X-Gm-Message-State: AOJu0YxjHMiJ23sn1pm51on9fgMKAKKT7NQ/9CBgwItTvf+XZW8V+6Fh mZ4NzsQw/nZ0Hl/4SL0wXnEkoMXnCg2YVOPWohFL3YFuXIE= X-Received: by 2002:a05:600c:4686:b0:40d:5cea:895f with SMTP id p6-20020a05600c468600b0040d5cea895fmr1291944wmo.115.1704469672293; Fri, 05 Jan 2024 07:47:52 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id f8-20020a5d4dc8000000b003367ff4aadasm1612817wru.31.2024.01.05.07.47.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 44/71] memory: Have memory_region_init_ram_flags_nomigrate() return a boolean Date: Fri, 5 Jan 2024 16:42:37 +0100 Message-ID: <20240105154307.21385-45-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_ram_nomigrate return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-2-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index f172e82ac9..1df7fb0fed 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1310,8 +1310,10 @@ void memory_region_init_ram_nomigrate(MemoryRegion *mr, * * Note that this function does not do anything to cause the data in the * RAM memory region to be migrated; that is the responsibility of the caller. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, +bool memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index 798b6c0a17..6110e851f1 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1555,7 +1555,7 @@ void memory_region_init_ram_nomigrate(MemoryRegion *mr, memory_region_init_ram_flags_nomigrate(mr, owner, name, size, 0, errp); } -void memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, +bool memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -1572,7 +1572,9 @@ void memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, mr->size = int128_zero(); object_unparent(OBJECT(mr)); error_propagate(errp, err); + return false; } + return true; } void memory_region_init_resizeable_ram(MemoryRegion *mr, From patchwork Fri Jan 5 15:42:38 2024 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: 760222 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp111341wru; Fri, 5 Jan 2024 08:01:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfOE3GuSLl6ScIg48VKphGFK5MVYJKXjKsDL+6RKmgACyb/EYBr39qhWj68/jq+6IpVwiG X-Received: by 2002:a9d:6d01:0:b0:6dc:14e5:b212 with SMTP id o1-20020a9d6d01000000b006dc14e5b212mr2118742otp.41.1704470498465; Fri, 05 Jan 2024 08:01:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470498; cv=none; d=google.com; s=arc-20160816; b=fPoWgGFQD0h5YxVw7752i6pVvHWBIQ/zl1FLSOq+Gc1Lcg/IrirStpwIIAipehzcNX 1hvsORjpxzPZYzDuSmewhXsTWdGOr9GoyKRn6kSc2+nOkr6+/IE6G29xG/sm0cK29YDs Qbu8hDCt+p8elcg7UPPlfiyOrNwr9lFBkMscx85l9i2FDgpmPQ7zvBkMOfizDnXl/Tcx m1truDMZIgxUGElWh9gQHTg47a3tfGJvW2DvVf36pHcKEqPhhpLfTM1lpBvnpmjLF67C I5/sSUJ21ZmcikIBPBmgq2bZhqePIESHuvwHUwoYTFVFfFBWtBc5peDb32sEeQFe4mpq odMg== 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=Ts6/p06DbcZO3DzbdTMKNYyTx2gw5NVQT7hGpH+Yf50=; fh=ommUZV3lVI8TSdtrCh+lREq94RlB1kCBJbnpVILHDbk=; b=brHtVirL/Kjs4yI7bLZZegQ85cM1drDowf1QN8+nFhui8GHeYBmLcfJ9CuxtO/3VXY DVXR25vvFXFSwU9dZ3cmrafeThQtxDO8Uq3QrRuABqxEyneIPVH5fxbjhjeyeNCaFcGv pXKbHZ0CyQupy5cS4AjMQyOqx1/5EgjbJ9H6aCNgl5nEN2U7l3HV/SOrHV2i5Rp1seYl DcW+NjLCgPwdWlrn1J7Pz3x+efVX/3Hu3eoprbIP5sUWNdvNRmuIhhC7UJhu2CFXSlzl GViPIOIsWP/xVe8SV+JpWx/xSnK5HnWCBLjpp4s7+QYg0gBr/jgjvkJeo9H2ODpecH/C BsPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zEu7/IrG"; 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 cw35-20020a056130222300b007cdffe65850si222202uab.13.2024.01.05.08.01.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 08:01:38 -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="zEu7/IrG"; 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 1rLmRA-0003Ev-Ao; Fri, 05 Jan 2024 10:48: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 1rLmQV-0000F3-MX for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:06 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmQR-0004wM-Hx for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:02 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40d5b89e2bfso16307005e9.0 for ; Fri, 05 Jan 2024 07:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469677; x=1705074477; darn=nongnu.org; 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=Ts6/p06DbcZO3DzbdTMKNYyTx2gw5NVQT7hGpH+Yf50=; b=zEu7/IrGDpDeIr2dIyiR40b6RX7Rw5UhbZ6q/QeeQvsdv03PzLd3jldCm7pSJMuLLv SjmnKVdLeKEXJfesS3NLTJbhxto3zAlomPsnYD0Csd5QGfCbF7Evk1M8jLzGnKuEBqzS b6H8SKBm4DKSfFXyzxSHeUqiShDU1BZDb8QkYlw6QVwAlJqHw7wp2XtauZPqCLAB+FaK aZ/d8YmaWrm6yp9Nb58HzkmyvqEPN7b3Wkk7lQPHHJ4YT3lPxcFvYtTNa36QOzcDuIzC 1Wvrc9TbagoepY2xHIdgxmQ8yuBBeeNRNWGypPlS1hr0mflAmRF2yUXN6tLyqYvIqeCl hFfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469677; x=1705074477; 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=Ts6/p06DbcZO3DzbdTMKNYyTx2gw5NVQT7hGpH+Yf50=; b=rh9C9rVP5rRaEn/yHp9uzkg21+66K4W38qXuxIxzDK1h5xaplmmgnyfvPXyEXCLIH5 AUOjaJ5i2cQSoJhGY+VNzRJPhBmffkvwyIj4sp/wHb3PdU3yTPHSl6uEq1uHQhzxAVaO bndDwSVoYXDXOONrYmvvFYBCMK9Q+alsWdA9BDZuOL3Haq9AeI5ZSzVcEX8GLJoWUlEH NN6uh3Vkv5kS+iyJobqCkUXpUrVo6ptMoAbu3DMphhupzNWtIJpS9sLAPatg3siQi2mG TMuELS4alZ8SrDok64DmvN3PFO/sWNLl23EHoaKLsA8jCp2Y7yZiXdEhg/ciGBMI/z5K IJUQ== X-Gm-Message-State: AOJu0Yw8UsxHhmyQQj7X+b6kmTffPxdHrae/cqDVadKbvw2c8eMHlKeh h61WPu/s+kw/x9K6+47uFSiR/foq93VDXPh0JR9ocs6nX3s= X-Received: by 2002:a05:600c:1c0d:b0:40d:7f71:3f4f with SMTP id j13-20020a05600c1c0d00b0040d7f713f4fmr1300112wms.176.1704469677641; Fri, 05 Jan 2024 07:47:57 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id o16-20020adfcf10000000b003364a0e6983sm1601482wrj.62.2024.01.05.07.47.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:47:57 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 45/71] memory: Have memory_region_init_ram_nomigrate() handler return a boolean Date: Fri, 5 Jan 2024 16:42:38 +0100 Message-ID: <20240105154307.21385-46-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_ram_nomigrate return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-3-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 1df7fb0fed..413fbda089 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1288,8 +1288,10 @@ void memory_region_init_io(MemoryRegion *mr, * * Note that this function does not do anything to cause the data in the * RAM memory region to be migrated; that is the responsibility of the caller. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_ram_nomigrate(MemoryRegion *mr, +bool memory_region_init_ram_nomigrate(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index 6110e851f1..f9e5ae22d5 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1546,13 +1546,14 @@ void memory_region_init_io(MemoryRegion *mr, mr->terminates = true; } -void memory_region_init_ram_nomigrate(MemoryRegion *mr, +bool memory_region_init_ram_nomigrate(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, Error **errp) { - memory_region_init_ram_flags_nomigrate(mr, owner, name, size, 0, errp); + return memory_region_init_ram_flags_nomigrate(mr, owner, name, + size, 0, errp); } bool memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, From patchwork Fri Jan 5 15:42:39 2024 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: 760213 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp108986wru; Fri, 5 Jan 2024 07:56:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9XTITFYLH8IuK+/5y3fhsbs0fp9aYQKU9tyG2kTa75ItXDhwWQ5eI3AeTtQ8f34XTKV8o X-Received: by 2002:a05:6808:18a3:b0:3bc:3797:825b with SMTP id bi35-20020a05680818a300b003bc3797825bmr1026954oib.21.1704470214973; Fri, 05 Jan 2024 07:56:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470214; cv=none; d=google.com; s=arc-20160816; b=X7O+x8WEY+VTBPdOt+D/BdudJZCT3xTf99RYv8SbCDkgM20I978cd8vIOl7Qs7N06X 43IMFwnB4ffdvneXu4OtwpyS314i/59ZHUIvS7+uX65iP69U/4o/WMNCpKjhcB8YiENA 6MUA0CR+y2ASU93dpYNkj5Mfz3V6xPR1Lrd8bvcCmCe8hG9Hb52Jl+Pk4VKJDgHxIf37 PKgbQEk4s9p0s+vxxBUE6YXWlyAWrVRXO8uD93v/ojkHvfBPsbaCN261PQmky5n/Bosh TvqxkJ9dlSBwyuO6OKm5yMcnDk1ENptS0KgmfVKtnxhUrPBPyyQuJrYJnwWEhWhZYGGk m10Q== 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=9bo0EnTBB3RSA39/U6I4CQ9tWQh3q7HE8iXyXM+NS6g=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=jihMkck7zL64aYx3Kr1IIhEBuuHB/rNGYyfwv+jz195MHRUNptgKIiQd8OSf25DeI2 TjOyBxxs1urMmrit2FnoCuU3d+wI2GHXilfhyra3yV57mU5dpafXSsKRtguBC8JVihkS txmK4zWwdKXKh0/Aymy1nNZ3F6DYr0McPhVqobAFfi/E1tz07Tpcak0VSVQ7Z38f+Ccp L6t9Dg7kCjAaYW+F61zG3YuDxxFC7776PJ0eSwFV4nXmOE0IEHjn0NI6Ol9rUaWYU3Wn ioecWwp6U9VWSKUwj+8KEC6wfu7lTDz5W3W7xhJHumTPWbfJjegg9CxvhD08R8j9pOyo BpAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zysmM0Mz; 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 j20-20020a0ce014000000b006807fab8d4esi1989674qvk.74.2024.01.05.07.56.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:56:54 -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=zysmM0Mz; 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 1rLmRE-0003qR-MA; Fri, 05 Jan 2024 10:48: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 1rLmQh-0000Zl-MH for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:20 -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 1rLmQZ-00051j-PP for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:15 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40d5b89e2bfso16308585e9.0 for ; Fri, 05 Jan 2024 07:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469683; x=1705074483; darn=nongnu.org; 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=9bo0EnTBB3RSA39/U6I4CQ9tWQh3q7HE8iXyXM+NS6g=; b=zysmM0MzPDmI2w6M74MLyNnQMRZxVdkG59Hhf81CuNJDkx1ELkQ9yqyi4EmGn+AcDc l5W07oKCdBQXI6AHyZ1SPm9rEJhL0BGuDnQCunnNQqvwT+12ml02is3J6rynkarxg8d+ FBJ1EfSqok6ztz5ZKy2NglkCeILhA6JYZq2ueONHmf57iqB+E4cHB3sFnSb/53KvchVS ilOy06iIP0MOf+jU4K13yIDU+vK2ZbJ52rRZEz3+kEDvQNS4Rj+29xolz0noHHlfxKCp opBOVoYf6ms9v4YjtDvUoI1qSqZrahxH9M8UZn98kqGw5KWcAIobDqyuP3vqcQWS2IPM Ha0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469683; x=1705074483; 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=9bo0EnTBB3RSA39/U6I4CQ9tWQh3q7HE8iXyXM+NS6g=; b=KKMBx6pvefCnzkabWgx3WbaXe51Da5lyXioqUsT9h5ZcK+8l8jShBmoh10I3qJh96z 4MDgDjO5mg7L8gR9J0T+R7QFFrZdgU9Ly581QQY+LxktFSAda2rBNRZz+Fi02lEerqYV FMWgrei4QsREmBrTOHCDVWps8a2IiUFNezcHQSc6plmE1B8YF233Nka52dFMSLYMcWLB D2qLq+zBekCAaY5/1qOZifoly1HtZPx8s3v7AtnpD6D7vG0HK49YCZDMc6/uRyQdjrXX Iy31QoIh8HevTiuGwEsTdoJfwNPaJKsgKkKEP+PhLZvdAfLAq8zYI4jtB1if+/ZoANl0 VjXg== X-Gm-Message-State: AOJu0YxEDjEW+lH8tYvLB6AP4SDW1j1V7HaDutjdk6Q68sNYAYgeh6cV Vcd9uPb85VbHv3/T/RomWLAn/C/2YgQB8LvQgd3klqcDAQ4= X-Received: by 2002:a05:600c:181b:b0:40d:3a32:7d51 with SMTP id n27-20020a05600c181b00b0040d3a327d51mr1222446wmp.119.1704469683198; Fri, 05 Jan 2024 07:48:03 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id i16-20020a5d5230000000b00333404e9935sm1615796wra.54.2024.01.05.07.48.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 46/71] memory: Have memory_region_init_rom_nomigrate() handler return a boolean Date: Fri, 5 Jan 2024 16:42:39 +0100 Message-ID: <20240105154307.21385-47-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_rom_nomigrate return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-4-philmd@linaro.org> [PMD: Only update 'readonly' field on success (Manos Pitsidianakis)] Message-Id: --- include/exec/memory.h | 4 +++- system/memory.c | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 413fbda089..f3a4a76817 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1498,8 +1498,10 @@ void memory_region_init_alias(MemoryRegion *mr, * must be unique within any device * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_rom_nomigrate(MemoryRegion *mr, +bool memory_region_init_rom_nomigrate(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index f9e5ae22d5..72c6441e20 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1701,14 +1701,19 @@ void memory_region_init_alias(MemoryRegion *mr, mr->alias_offset = offset; } -void memory_region_init_rom_nomigrate(MemoryRegion *mr, +bool memory_region_init_rom_nomigrate(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, Error **errp) { - memory_region_init_ram_flags_nomigrate(mr, owner, name, size, 0, errp); + if (!memory_region_init_ram_flags_nomigrate(mr, owner, name, + size, 0, errp)) { + return false; + } mr->readonly = true; + + return true; } void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, From patchwork Fri Jan 5 15:42:40 2024 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: 760208 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp108427wru; Fri, 5 Jan 2024 07:55:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJ/1V0/lbS/RKLBNuWI0RRFv+thIBt4gJ9eNUaAdic6cLmsAU8KBLG6ipI0Ed/qaOKQvZI X-Received: by 2002:a05:620a:15b8:b0:781:4143:b980 with SMTP id f24-20020a05620a15b800b007814143b980mr1873308qkk.61.1704470129383; Fri, 05 Jan 2024 07:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470129; cv=none; d=google.com; s=arc-20160816; b=MWICZOCaHKX4g2sRAaee0kzUo+vmiF5cqMopItycH/xwhlQTqrLvQ03m60xm1smnUP OhFwjlvmbdlmkPYMWullw8XMGZiMLP/Wwpj3AAslYLeu5aHJInXMBDjOkxWRuZA6bBPf FqRMgTyyPWkFSEAl2rmCOcpjPNKc/dtUdoS+oW9wSm1qVsRrGiOfUTc1xbElRbo+8dhJ hnPhHbKT0V9/wBFi+zzA1LYrUkXorg9ekPs37H1aWGoertD/2juywyOMLXnmGUkTX1ZD Ajqjr55MM/izGPDqpkjUv634NHwgFQxGynNbLsGO149AEFVUdz99jYsslRIkbmxM2CdS KCeQ== 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=rwNOMMIAYzGSLWabz4mQJXWqt1PJzQTuexNMmuOK734=; fh=c+l8ms79slf+HkInAquXl8YtF8vGf6PikhLcunVcZ64=; b=s9LGBGex5Ty1A6xG9A5/c5Wswprs+uFBcIC5XYZLEigLud7WbCbvenikP8Y2ExlM3x zJmZ0puwn/hTKFZ3SNVkjtf9OFBHD+oKVss+Fx1re4AKD4bzlM8oSDLPRDaSw8hxp2AM HX3TG+i4uZc75GAtDM0aQ0RCtSuDXWGXzK1GZrmELlw2uTKZWj22d402QUn6s3pB+/0V wsUHHDZFMd8eMEgOzgzrNFY4ee7r5kDkYlK46YgUWh3jdp5E9f0WO19IAx8S0nyeqB2T uWiOZwixhCJlvtByVKhxUtUn4/YQNBT0uskP9oDqEoQXz48zyrTxod65a9oZ0fazp4+n jXtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zTpWELja; 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 y19-20020a37e313000000b00781b518af18si1885039qki.709.2024.01.05.07.55.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:55: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=zTpWELja; 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 1rLmRK-0004Vt-M9; Fri, 05 Jan 2024 10:48:54 -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 1rLmQe-0000WW-NX for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:14 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmQc-00052M-EM for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:12 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-336990fb8fbso1224171f8f.1 for ; Fri, 05 Jan 2024 07:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469688; x=1705074488; darn=nongnu.org; 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=rwNOMMIAYzGSLWabz4mQJXWqt1PJzQTuexNMmuOK734=; b=zTpWELjazCjgv0efnlE4zgCZ6HMfKPlhg7nalHCtNUcEufcNlCWuRjuP6LJ9uo75Ur +ULrhv/L//U7gescR667EK9aNhCAPgAS8DWNrKeVSbPTXSLugeLAee/nUj3nl4cEBez/ F331TfRBGXG4m0zMU6p+k6Nh0HmUpU0NP91eJFH1AGeyRcyX2GNwnhPpWO9ksIBaZlps eR+BMefEpXYEBfigksRECRFsDbzf+JDqMOeGJVmHb+MRGf37TATqYwxecIizGM5M+ZD3 7TxuOS9ny3tgcLdMuthxk+SbODKAIGH7osJoZBxrlUBgL/0xxDSVgVPbryjwvtywRgcy kFdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469688; x=1705074488; 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=rwNOMMIAYzGSLWabz4mQJXWqt1PJzQTuexNMmuOK734=; b=ZGca/5HBoc+Q/9fXmWFSsAz3bwFx6DhyuyAz9pITAZRACkH3FuGjGiOpfS057LKHJu 5VrJInZyWjMuN4NhRcrLMefk2ZZkKCHQxnhYSHX3U9R5HIiP/Z3uMyq0jojKf+Gycpae gTqA7/hIUxmpr+E6fvPygt7euOh7nGOoE7KE63BEZJjMKyQ1Kgg+oN3CSQL9JFFUKEP5 z+bL7NG/TwhOB9zF747SMcWVKvDAjeF9iqXsO5wWexxsCmeESpJWNjNC7PPLmGjItnyB obuTpjxXuV58xxcNWxiva5rQiWmEtw4LyWwoWQyDXk7J56j/jvwEB/cwDsf+AUM0hBDk F4+g== X-Gm-Message-State: AOJu0YxjYS25e+9Ps07VuH0N7sUCvB0GKMsTXN87JoLe2LEy7+zR4LyZ VH59wzfiKhrbhDI+U5ESKVUAxmum/5iCMHc6KZYQfN4TRYM= X-Received: by 2002:adf:e0d0:0:b0:336:e366:471 with SMTP id m16-20020adfe0d0000000b00336e3660471mr1336264wri.58.1704469688486; Fri, 05 Jan 2024 07:48:08 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id o5-20020adfca05000000b00336ee9edbb3sm1605985wrh.94.2024.01.05.07.48.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Richard Henderson , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 47/71] memory: Simplify memory_region_init_rom_nomigrate() calls Date: Fri, 5 Jan 2024 16:42:40 +0100 Message-ID: <20240105154307.21385-48-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, errp; @@ - memory_region_init_rom_nomigrate(mr, owner, arg3, arg4, &errp); if ( - errp + !memory_region_init_rom_nomigrate(mr, owner, arg3, arg4, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-5-philmd@linaro.org> --- system/memory.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/memory.c b/system/memory.c index 72c6441e20..3997ac5928 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3601,11 +3601,8 @@ void memory_region_init_rom(MemoryRegion *mr, Error **errp) { DeviceState *owner_dev; - Error *err = NULL; - memory_region_init_rom_nomigrate(mr, owner, name, size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom_nomigrate(mr, owner, name, size, errp)) { return; } /* This will assert if owner is neither NULL nor a DeviceState. From patchwork Fri Jan 5 15:42:41 2024 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: 760195 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107413wru; Fri, 5 Jan 2024 07:53:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHblHelxkVeGcRCi9a8lCm+j3pnsNyCwI9rbtnmz9daY42O5PC7ahupQHNAC9bwV0PF+tkH X-Received: by 2002:a9d:6a55:0:b0:6db:ffa6:6c4d with SMTP id h21-20020a9d6a55000000b006dbffa66c4dmr2385174otn.24.1704469985783; Fri, 05 Jan 2024 07:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469985; cv=none; d=google.com; s=arc-20160816; b=EhR9ZDKbk4tRo3782dOQYgcyvB7KzT9u0KX7LRqE/+s4+iyBoY2zTJmS4F9zk+zzBz ZM71EE+1owFRYPecRAHeqnAar+wauMBfFDad7VgOW+6IB4Pm8t0kbJFoGHxuauVOQsZR zXoH9c/bWeGJ1mKCp/i4Knw8ypyypwQoyvvqV+ppLsshzv3LW+n7rskhWJDa/pirdkeM 3wu9I55MCEppGHzrLXkx3xpd+bLnsusrgn2KTwzON57hAsvGF36e0vZ6p2XxmHft5FNq sNDsxOOqoWEwoxQOUZ7Ef9YCXxXFtHk1hPkbSl2wBQhfk95Gk9roxkZIDTCTOYwyEhMs sZ8w== 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=6o3ekhlfh/+CPANGecFeiASb4d6bBwdSECTd289TNhk=; fh=bAtNkVgv7qoy5BttpF5et4l4pnNgrQnvD80xBkOr5LE=; b=rck0wAnWcxchaua0nxtnDkHf4KbyZ2unClXIGaAVBUMuCChHCAwkDWacZydY4NVtIo afNiMB8wk1oPy1TqAMOhHY9zVabeX3iFg9Is/IGr6My2zTXpcIOG/qqw1vKrKP14YXdj cUWtf67BExzmELEMsotegiLRZTx8rfTl5niiEYnIkG51Esvyd+87QcYVOcYSDgK/Aluu LsobSA/ab7TNKH1f3aSe6JvW7dcacYZsOtMWk6Ueh8LHPDtpeErajDnha3TJLqXZ7Lg9 Gn++ae8hgQgJsg5a9db5OOjTnvcDTFXYZ+c1r4z3sj2uwl8HUTaVtKM8IG/bXMpTFEwg IuFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DQ2QHVer; 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 h22-20020a05620a13f600b00781792e09casi1843229qkl.572.2024.01.05.07.53.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53:05 -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=DQ2QHVer; 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 1rLmRY-0006FX-Hy; Fri, 05 Jan 2024 10:49: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 1rLmQi-0000Zw-Vf for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:19 -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 1rLmQh-0005BX-Ag for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:16 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40d8902da73so12874145e9.2 for ; Fri, 05 Jan 2024 07:48:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469694; x=1705074494; darn=nongnu.org; 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=6o3ekhlfh/+CPANGecFeiASb4d6bBwdSECTd289TNhk=; b=DQ2QHVerxwTlhr1DqwDw79ObknnhCQxFTaaeZuBVVYMFATrYKkTM5ov94YvUVSbC+s r4OfWgetYJCN0rvRqkwXfpB/GFKjRN2PpVDvO3Jw7lACaRBlcJvahrqNexRnJ4fCcmVy hE6I99OAkXqylZ4Wyuma5VSqAD9t/bQOeOv/6vBLFQeNoIiaPXxFMphm6Bg4ZO3MOPy8 v0gjaVImO96C8xzzUgDHWzZBCZmEdqwgCorsKJ/pDYBQekiuUNtAC2AyqQMS9u84LXtG 7iG6x7g5lESq20caGsdyR4vvdThmeVmraLFKbGkImHhVuar87CANvafTDSgegrtmJTHH cdjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469694; x=1705074494; 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=6o3ekhlfh/+CPANGecFeiASb4d6bBwdSECTd289TNhk=; b=gA9hq1PfHfKPD3sjfNd/a1HuOP91EGiGIvebT2F93n4rD0AsRkblRY8c8C1y99Y2Nu FE1f/WPM9y6Ker7AEz4JsqWySOy/F+PxVdJhKCbHt7jaWA+VvmxKxdVHJYy0OsMpATek FBtGmQcK7BXMoGWnW+Z+hfplQX+hMvlNmDh874xLSVzKJML+D0WSvEumVR8GT6+DB4K/ 5ObVcDATkc81u7g+e3PNxUbXDL+iRZ4l/6Qoze7h/6YSsyWUK9NnIZdmHnHlsWQWui0X seqcGjyzjqHTEM+w27nmfSz5qSJ+sEcSFa1JgZ9SDFdxsKzL5eeyUItZMmNrg0I+Otyr +aJA== X-Gm-Message-State: AOJu0Yz5F9Ii+tLBxYBUud1rJY2RGobrYO9E05GT62vu7Df+x3RwgCm9 BA8sx/G4LBjfBQzGeiUX6lScB4HdedUzqRBpOZ2SJsrg4T0= X-Received: by 2002:a05:600c:4f51:b0:40e:3a6f:9b1e with SMTP id m17-20020a05600c4f5100b0040e3a6f9b1emr370957wmq.109.1704469693840; Fri, 05 Jan 2024 07:48:13 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id fc12-20020a05600c524c00b0040d5a9d6b68sm1952853wmb.6.2024.01.05.07.48.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , Paolo Bonzini , Peter Xu , David Hildenbrand Subject: [PULL 48/71] memory: Simplify memory_region_init_ram_from_fd() calls Date: Fri, 5 Jan 2024 16:42:41 +0100 Message-ID: <20240105154307.21385-49-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, arg5, arg6, arg7, errp; @@ - memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, &errp); if ( - errp + !memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-6-philmd@linaro.org> --- system/memory.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/memory.c b/system/memory.c index 3997ac5928..c1374e9968 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3577,11 +3577,8 @@ void memory_region_init_ram(MemoryRegion *mr, Error **errp) { DeviceState *owner_dev; - Error *err = NULL; - memory_region_init_ram_nomigrate(mr, owner, name, size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram_nomigrate(mr, owner, name, size, errp)) { return; } /* This will assert if owner is neither NULL nor a DeviceState. From patchwork Fri Jan 5 15:42:42 2024 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: 760196 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107448wru; Fri, 5 Jan 2024 07:53:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzML7YV1M942xmoB0Cv7xK43q2+ps16/q7tVgf3NAeWQfOnxbLFkdVJsDLUa7uVZkAyU1N X-Received: by 2002:a05:622a:428c:b0:428:12bb:ae1d with SMTP id cr12-20020a05622a428c00b0042812bbae1dmr2479797qtb.120.1704469989683; Fri, 05 Jan 2024 07:53:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469989; cv=none; d=google.com; s=arc-20160816; b=MbjaAvOFx9hUgHWqPx5OG/FqhkWKEqfa+IxWZgChMFCt/O7PoUKcQrQyCUxWUn39y0 /uOY8LQeLsO4zhaUMFH3Q2OCn6aTYCC4XsEYQNe/pbUb2aq7Wuc/wP2ri79FftM9aN4M 9/xm/y5LAyRg4OZR5sGGKgjhX9XNyIDSvkesRXPiqh+OivH3zOMnPDDe/A9wsyV3Bkc2 3UwsD+lyebCDv1fyaVQ5zCmUyhSKJJMYjxP4GKtcR5EUt/Fe8Q+BglnL+6+Rjf2Xik2u Bzz9/g9HwohKTO/61yviOEhQc/9lqdZSzCqkLlc8JLArOHt5Ek92kcrHwNxqp8hISkgk DbVQ== 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=fJr6Vags3Wq7daq7HscgC4QLRNTQj0/WuTPsCBO9nBw=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=oC9uJDRL7AULWmhv+Eu10P/8S84e2Fh+NsMRxzNOYkKxKPkoTFk90umdlsLdhXkMFL MjSixZAPCY58HlNuE8agEHT0pyGcCsE/fcNHxMbt2Go/lDKJb8QtlEWHHz3TCXjNQz4m 6MNf/T+6R/ZhIukApyNXI4csnOo2BGyhi8EemvO++iD1RIwdUQUFtcwM2QaJELejGah1 Bn8CuHygY3fk6keh+tKWTLNpOY+jmlXlQKLwvXcOzMJ6OgSkOGguQhcuoqnfxtIzi3Oi JdIRKTcHN4KzSULTq+7IonSeEES0YPf3xOMxeVlEsfXctuZMhrmAX/blPfa08gGMNj2h HmHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WoeHDscv; 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 q9-20020a05622a04c900b0042962fbc5a1si2154843qtx.266.2024.01.05.07.53.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53: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=WoeHDscv; 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 1rLmRO-0004tK-Nn; Fri, 05 Jan 2024 10:48:59 -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 1rLmQr-0000qZ-CV for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:26 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmQo-0005LP-2U for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:25 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3367f8f8cb0so1469989f8f.2 for ; Fri, 05 Jan 2024 07:48:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469699; x=1705074499; darn=nongnu.org; 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=fJr6Vags3Wq7daq7HscgC4QLRNTQj0/WuTPsCBO9nBw=; b=WoeHDscvOsCNm8ZzhcJciSxyZwtp5X+4nI8BdIL/hVQ2ZWtP89Eb/0JA89zYRHFVJN UJBFOL44qkYyWQnPJR4Q0b41yrsyyzug+6yHw/sSNiH/k2eg5HVict6ApyGL1f7yzf+U hf64CvyjvDNV8vpEfAw0es5IBEt4N1x1jzXxeHpM2anYQmDQYpRXNNwDEuP/jEbQISVw p0C8IlfFH6itkvXhQjb2tzGCEMYRjP5fZWPz4oiQAoTLsN85l9GUXzKumWS3fGYNdj/H gv31cK8mFKsNVlja+Z7ZYKkHTJi/tCiHRJfS5WRd4zkXa1TkOQkBosY8yk4YX6DPZ0p6 pU+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469699; x=1705074499; 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=fJr6Vags3Wq7daq7HscgC4QLRNTQj0/WuTPsCBO9nBw=; b=iTxJgJrE5SrQgiM3xAgPIvohJ5hBe2tZtiprd4NiGoYbgy2aazWDTJOLoYGxM7Syby eACB67dGKFP0IVn+ds0FI3vzRnGwj92tD0HRyhd5dKo++IsgxAsN6KyFrS+5OdyG4g1e ovRJXH2RUHfojTzeiEYQbdpZ0ePMNPwHYCkM56m6+Z2mDi585joYfB9Ftow6jcxVrLQy ZBFY2LSw6qoixA5an+FMN3lfJRDkFHYbP1wcHLDT1y7unXonYT87KKT38COec3yQRegU gRScylX7g+lX/pYKGRWrCJiT67IbxQSxhp0Lel2HVZsrrdWOiTwgyBbMBOo7jFOYcVBN 7gSw== X-Gm-Message-State: AOJu0YwbDdYfOmzjOzXkEbNsbV/UhKNor0Zh2yIdTzzCyHFOLRUlS2Fh EtnRirjJX8YHNWNCfRyTqAPEogiQidhEPRlLltpbif8QdPA= X-Received: by 2002:a5d:4489:0:b0:337:2b76:30fe with SMTP id j9-20020a5d4489000000b003372b7630femr1274977wrq.37.1704469699264; Fri, 05 Jan 2024 07:48:19 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id h8-20020adfa4c8000000b003375083ff8esm1626753wrb.32.2024.01.05.07.48.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 49/71] memory: Have memory_region_init_ram() handler return a boolean Date: Fri, 5 Jan 2024 16:42:42 +0100 Message-ID: <20240105154307.21385-50-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_ram() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-7-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index f3a4a76817..b2dce73e7f 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1582,8 +1582,10 @@ void memory_region_init_iommu(void *_iommu_mr, * give the RAM block a unique name for migration purposes. * We should lift this restriction and allow arbitrary Objects. * If you pass a non-NULL non-device @owner then we will assert. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_ram(MemoryRegion *mr, +bool memory_region_init_ram(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index c1374e9968..45ce6fd6c1 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3570,7 +3570,7 @@ void mtree_info(bool flatview, bool dispatch_tree, bool owner, bool disabled) } } -void memory_region_init_ram(MemoryRegion *mr, +bool memory_region_init_ram(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -3579,7 +3579,7 @@ void memory_region_init_ram(MemoryRegion *mr, DeviceState *owner_dev; if (!memory_region_init_ram_nomigrate(mr, owner, name, size, errp)) { - return; + return false; } /* This will assert if owner is neither NULL nor a DeviceState. * We only want the owner here for the purposes of defining a @@ -3589,6 +3589,8 @@ void memory_region_init_ram(MemoryRegion *mr, */ owner_dev = DEVICE(owner); vmstate_register_ram(mr, owner_dev); + + return true; } void memory_region_init_rom(MemoryRegion *mr, From patchwork Fri Jan 5 15:42:43 2024 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: 760211 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp108684wru; Fri, 5 Jan 2024 07:56:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwEjhrapaBDapaPnn1Tbu82ZXM1MBYmBSR8EI5ObnxS2Twb4lJtRfY+Br2ansAMIOejBTz X-Received: by 2002:a05:6871:2106:b0:203:7c4c:a29 with SMTP id sa6-20020a056871210600b002037c4c0a29mr2050308oab.77.1704470171075; Fri, 05 Jan 2024 07:56:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470171; cv=none; d=google.com; s=arc-20160816; b=HIHxq5C0oIN5isdOoUu28XC7jDky+us5Ad2qcALRY7Fy5VGJE6sKIv7X/UWwsmMAiU aRfh0zbrphuAvAmVPyrCBwgezkzGsF+HDM/Z2r1/LJj2YGp4wdqBYrkUycZket1u8vd0 4xt4MlU/MQaAFVCnpGM3d55hd27UXWZ4P/IEYrs4fpG5FXEJljE2hwnLEpO/hbRChpsr BO89g1vrIsJei48bG75ORoK4+Ag6HBELXJWmBwDyrICROhTPPUmz87JhVIGd3IzTRIry /RrwE3liD+1omFnA598G8iOO8KMuoISfPQSvGdxAaQpf+0aFBFqDBkfjdanMgLDIAGBw /FEQ== 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=e8zWpxEGvFP2nXrr978iIGsIcrnYa4bpuJyK2GzP0xE=; fh=bAtNkVgv7qoy5BttpF5et4l4pnNgrQnvD80xBkOr5LE=; b=EXHKB+JvSqpeXj02japZ7N414kOcqpc3UUcwN5hSXFAXltZar8qcCGMaR0mT6Xxcsc 6ZZNiCOi9unnSON35h1eJI0Y9qwRMQkEuMyj+7AA/aZESt/jfU2/lBN1pWn4bJ2Vp8tO ApvycGM33oHIG+30QnEZ1tpichnrfpEV1ihglBSfkI8+ChMojBsCPW9M3OawA5ZS+lHA PnjSfhkzs3kHZGU9vP2MBi+OiWhnG1/uAeNgFAVECBnmoMaDD1Is31DcFntsCgAoH6jU PoN4bVkoyytDe5MsftPGzEyIoKZPp9O+N9YzQxbKDnrboDGTkXjy7LTKjxDHTtZ+Hlqo 4AWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IAMpRvyx; 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 z11-20020a05620a260b00b007816dc2ef5csi2069173qko.780.2024.01.05.07.56.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:56:11 -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=IAMpRvyx; 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 1rLmRK-0004V9-1M; Fri, 05 Jan 2024 10:48:54 -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 1rLmQv-0001Qx-N7 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:29 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmQs-0005Zz-Er for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:29 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3368b9bbeb4so1499947f8f.2 for ; Fri, 05 Jan 2024 07:48:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469705; x=1705074505; darn=nongnu.org; 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=e8zWpxEGvFP2nXrr978iIGsIcrnYa4bpuJyK2GzP0xE=; b=IAMpRvyxjYt7mxulDGfnO4xq1nBMc2bgamuqFO/XC0qzfPozrQmPnU+eGuOF25jDT6 SZkhNLmfFk+xdjj0Yy4Fz9r2YtXKeFF4+XJKPR+fSqlytfpLpoiFifAz6iTL3YPPH5pN AF1DIPNxlGrJHpAQGe4H1uoZnBPDKCHVcjXl2xf8H4/rq5v5wp3DR6kAMyHi51/EbF1r Gg2e9aqMTrxBw5HNc31UmQhI/95NyGFvqYPKYtTySiTKx0snwKUP11833f6aAlDAHdU+ c8CWQq2KhB5zMGyYYCeO0BO2PdWeNPoNCVbe3zypFlF3MjgDMClFblKPN1JavVmoIgpE 7Hrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469705; x=1705074505; 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=e8zWpxEGvFP2nXrr978iIGsIcrnYa4bpuJyK2GzP0xE=; b=dhrbMinE9F7DBSu3JPaBI68fT7asJzYOV4BvAX3yVbWL130+P6gIRnXYJNWm/TfAF4 kF9duMnUbqxgOgB5lYx5ELLwWsAZO9VB0uk74fSmisZbvnsTTWKrxPt9HoSwWAlxxm68 dNKzvipuvieGkCurI7huv80uzXhEBc0lmri4cvBQOHdOlniGEF3qXau4lknxe9Euf4Gu JyihTq30I1xg9JPgs55wxBe7OmKxoVIujdA6dqxBQDluV8++ctMN5anNSH3dBcFOHV7O akho64W4SgDM+9q21Tn9yZh4n3YQeAZI+hUd6mVgNwwyqxrqvrn5sWteRYIvjAo6tR2p LcWA== X-Gm-Message-State: AOJu0YwTnUHC2yGDPydUtFl1RDuUT2O6ZRICYrhTwUpnfkk+/V9p39fe 40H+4qeGVIO3Ow7jpi4NhaUeS71kmQvG/aBF5B7XinO0Wow= X-Received: by 2002:adf:ef04:0:b0:336:4b78:f81c with SMTP id e4-20020adfef04000000b003364b78f81cmr590302wro.123.1704469704861; Fri, 05 Jan 2024 07:48:24 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id x17-20020a5d6511000000b0033743c2d17dsm1612853wru.28.2024.01.05.07.48.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , Paolo Bonzini , Peter Xu , David Hildenbrand Subject: [PULL 50/71] memory: Have memory_region_init_rom() handler return a boolean Date: Fri, 5 Jan 2024 16:42:43 +0100 Message-ID: <20240105154307.21385-51-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_rom() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-8-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index b2dce73e7f..9f54bc4af8 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1611,8 +1611,10 @@ bool memory_region_init_ram(MemoryRegion *mr, * must be unique within any device * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_rom(MemoryRegion *mr, +bool memory_region_init_rom(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index 45ce6fd6c1..069aa5ee08 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3593,7 +3593,7 @@ bool memory_region_init_ram(MemoryRegion *mr, return true; } -void memory_region_init_rom(MemoryRegion *mr, +bool memory_region_init_rom(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -3602,7 +3602,7 @@ void memory_region_init_rom(MemoryRegion *mr, DeviceState *owner_dev; if (!memory_region_init_rom_nomigrate(mr, owner, name, size, errp)) { - return; + return false; } /* This will assert if owner is neither NULL nor a DeviceState. * We only want the owner here for the purposes of defining a @@ -3612,6 +3612,8 @@ void memory_region_init_rom(MemoryRegion *mr, */ owner_dev = DEVICE(owner); vmstate_register_ram(mr, owner_dev); + + return true; } void memory_region_init_rom_device(MemoryRegion *mr, From patchwork Fri Jan 5 15:42:44 2024 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: 760186 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106883wru; Fri, 5 Jan 2024 07:51:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHm8uMbHr5PIRFznc5wXpIQqCEu8UM/AaI+Ypzt7Yh/CscejUVSGaNm5VQ3JV5ygYorrZdl X-Received: by 2002:a05:622a:189e:b0:423:ab46:a41f with SMTP id v30-20020a05622a189e00b00423ab46a41fmr2125887qtc.47.1704469916052; Fri, 05 Jan 2024 07:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469916; cv=none; d=google.com; s=arc-20160816; b=nWaovYw6tkNGJz4uarB61v17u9R2wVFpkhtXNk605qpmqMJmIaupCIe/srrieV5rgj 50S3C2G5fr5B7YJm0Yu2zVv2iX3IPyV7Oo5/JebRkDfpcgmUlXg+KG6pMMLYOrriPAoM 3i9t64MPaM0DE2l7sVc6I1aL1rptAwp8b/uuv+Rp6i2Z7TvPstCWLbdotszKJw4s8zsm 11DHsmgFS65GsQwyi0MsfrHOjIvcMWTpeZotGI43cLd12k5X3wcIReBKcRH37w97a7d4 05Yppjzrj6GhRszXTx9nFum9ZMcjWDLh7EFuRMuacvUP+26lcmTwuBrFCRs0erEJCiyA urBg== 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=pxeB5JHPsloAIkHe9tjmngVFFPhZ7Tzq56PtI31mi5A=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=HT8igyYaunv4NAZ7ljVmETVPvISCO/HodP/DQhPE/fMY0QdKF12rLuHECnZZ9Snpjp NdEzxqvNV2nCnvAELtsyrvMnueIXyRQ3mQWstTUv2UghMIV4oI+pK4tevntEI489zy3s qGYGKneHmhgt9qA/G9y0Nr32TXXvUetTCNSGvzPJVISt8Wdgz4Z7vpRMvwJw79JwU8cU qWED+h5y5npx0j6M4RFph3jyWDe452veIHUrJSgxAIJrKZj4rsDySMmwuCVeYZdXuPRU 9+N2cEJjY2LIIXxYRtO5eWJhd1DBiaycCBjAXT8FzA9M/RSfSucLfwUULYI8fsZRjqZk 6MxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r/UI2DJI"; 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 o11-20020a05622a044b00b004283b90c8e4si2038246qtx.517.2024.01.05.07.51.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:51:56 -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="r/UI2DJI"; 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 1rLmRN-0004cq-F3; Fri, 05 Jan 2024 10:48: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 1rLmR0-0001wL-0R for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:34 -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 1rLmQy-0005lV-5U for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:33 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40d76fefd6bso14855215e9.2 for ; Fri, 05 Jan 2024 07:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469710; x=1705074510; darn=nongnu.org; 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=pxeB5JHPsloAIkHe9tjmngVFFPhZ7Tzq56PtI31mi5A=; b=r/UI2DJI7ZXzSJoq9WxifR9U6Q0kDtzHeIEO4eFalKxCvKsetcZBrrG8C8Xl1PvAxY PkLUOCC9Qxh4DZP5ekaR1OmqNthHK4ujNKtyYYp8SNRJm6e5dtXkgixgO06obNkEXpKt GvdzOvgv8W+O82NNCcKBNI+msaac663by9A/Su3gweaAyWPpWMKSwYCGfpLOQmJ6DSxx g6hJUUm2LbuVn76IuCAC96y2FJ0/bE1qDaJYRQ9w/cBDFxBxF0dAOkUYZe3xEXaFITZa KCSC9j9tQgirrP3mMA8O2shq5PWonkQMgLLKmc4Tj7Thnq3U9UHsiVT9gD1hHd30aUXJ kUPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469710; x=1705074510; 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=pxeB5JHPsloAIkHe9tjmngVFFPhZ7Tzq56PtI31mi5A=; b=imvySgr9gUk3jtIoTMEJ9Tk4lmDYvg0dsM6M1knjsNBoKezAdVEpOLAXcYtEYxfZrk sdtO5cdEi61vK8Y0cWb+DijFQXc5/UqlqZfT6fhAad8rnGMtYDMZQeP39XgOYLH/zQlF adDdKaAKB9Gyvs2jMQRGkYTxOCOCliTH+699HSiZHcShI9hAWVS0kyHusr9TXeCNLikZ 5RAElaqXub/T4CRk+1+7xSejjWexNH8jpxQ6BnMPh8RijTiGNdvkieM/pLPi+T+G5LLS OoCur4LwGm6ZhsXesDR05pBSrcYXUw+V47Q5yITMwZ/IKIWR9M0PIK+qiHPXDeSE72Ct EDTg== X-Gm-Message-State: AOJu0YyPGUQoTVEzEuPaF7Q01UM5NxZyXMsArGfZ4e1fa0UCs+FK0ABh 6F+mz3DoJphTc1ldBh9zVDUtHRg6/oXBj7j8Vb90xNMF5WU= X-Received: by 2002:a05:600c:34c1:b0:40d:880f:4876 with SMTP id d1-20020a05600c34c100b0040d880f4876mr630692wmq.152.1704469710540; Fri, 05 Jan 2024 07:48:30 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id e9-20020a05600c4e4900b0040e38859c47sm1959505wmq.16.2024.01.05.07.48.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:30 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 51/71] memory: Have memory_region_init_rom_device_nomigrate() return a boolean Date: Fri, 5 Jan 2024 16:42:44 +0100 Message-ID: <20240105154307.21385-52-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_rom_device_nomigrate() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-9-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 9f54bc4af8..6d7b49b735 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1523,8 +1523,10 @@ bool memory_region_init_rom_nomigrate(MemoryRegion *mr, * must be unique within any device * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, +bool memory_region_init_rom_device_nomigrate(MemoryRegion *mr, Object *owner, const MemoryRegionOps *ops, void *opaque, diff --git a/system/memory.c b/system/memory.c index 069aa5ee08..8db271c19e 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1716,7 +1716,7 @@ bool memory_region_init_rom_nomigrate(MemoryRegion *mr, return true; } -void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, +bool memory_region_init_rom_device_nomigrate(MemoryRegion *mr, Object *owner, const MemoryRegionOps *ops, void *opaque, @@ -1737,7 +1737,9 @@ void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, mr->size = int128_zero(); object_unparent(OBJECT(mr)); error_propagate(errp, err); + return false; } + return true; } void memory_region_init_iommu(void *_iommu_mr, From patchwork Fri Jan 5 15:42:45 2024 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: 760194 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107354wru; Fri, 5 Jan 2024 07:52:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2+whvZr/m5VhE26Usk6Py6T85VkRVSGGgva+3rkeExyQN941ZWgtMU8Y6f5BMNd75nY3X X-Received: by 2002:a05:6359:6242:b0:175:404c:b2eb with SMTP id sd2-20020a056359624200b00175404cb2ebmr1798153rwb.35.1704469979622; Fri, 05 Jan 2024 07:52:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469979; cv=none; d=google.com; s=arc-20160816; b=zb/7n/D2TY4E4DhoZVdd7tbXtLhsfUtOVI3KRmPsv1gGMtkIX3bWmFYi8NyVjs+Jeo xOiiPOauE+rinImLTSPy7UtvRG66JOxsXIcC0jeOTYboD8UrWypTM9OFlacIlJ7r5u4s qpkqsRkDgiPc0AnLWSVpnVvoFzsQXgi8NsOPY5yM5J49sBhC4wnC24enS6PYGKnFu1DK IkCSVQJjGGYIOBEUwoM7W2I4VTJe/S0iI8MxT8qGTPLkyq7yL+q4v6d9tApVaEn1hi4W mH33J9typi30kgNhuW6hhLc6oMYOhPQYTr5q3mXepjVwlUuj1aH17Jfq9CEMXvyogMFF FI3g== 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=EqhTmAjxaD/BTNoVLzXvd/YAl4zMVPKwo4ul47FACnE=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=JI/5qFWyVB4N9xr3ggC9aM7G/cnevngtF6eYkb1mVIzUAb2a247P/sJtjpWV/YYji/ lrsDb1WBx9Sh5SNArQHTZLcPKyv4XB0ng8b75yPQ2SYRl6S+Q0cCl5pF/fxD88VQXUM5 UZBNYwPRM2qW3lnRahouFfXeo4kDuePueg+hpow/Ut6SkczXdBK3X0NXLRs40MxLmQ/R Kbj1F/RjWkhZesY4NDC8fUgcrxBhPCy5DwEl78iELYPXtFkXwn+7JGhwVYOJv1RLobzz AXhmSPiW19vDwRC18Gxgg8KSxuiMHoodO0s3AnoOZFoA+rGd8A+NvmKYuIDVE2pNZcCj ZtRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hG+QZSF0; 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 ff17-20020a05622a4d9100b0042826396678si2136716qtb.120.2024.01.05.07.52.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52:59 -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=hG+QZSF0; 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 1rLmRR-0005KD-Ba; Fri, 05 Jan 2024 10:49: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 1rLmR8-000316-Fy for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:42 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmR3-0005zE-LI for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:41 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-336c8ab0b20so1479148f8f.1 for ; Fri, 05 Jan 2024 07:48:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469716; x=1705074516; darn=nongnu.org; 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=EqhTmAjxaD/BTNoVLzXvd/YAl4zMVPKwo4ul47FACnE=; b=hG+QZSF0V851L7X8jojOvd9JZ4d5qjF9niXHq0p9KQj/BkYgySSeSx8M/nvxpE4D19 nXa2lYEQnTb0aATCyaoj6yQzom6DfeFg2LpcysBT1A1ANiXPCknvfHs6tA9SaeYDF/f1 U5g1gehpehK82xs48K3kz6+gZ5qhVFVlsf17Tka5pS4YxESQ9A5YmD55OUijQKeIkd3W n+BFve+c6BVfjZpdnS9aVeFZ8BUdjQcHKJhYQvRFfTJJFW9NeCJtylw/O9QXqkPLD1PS pTqkO/AqkpWGHoRJqxD+a8hRifOEdI83lS7BK27vfGfCFbyvY6iPZRSS59yM9kvI/lCr gN1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469716; x=1705074516; 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=EqhTmAjxaD/BTNoVLzXvd/YAl4zMVPKwo4ul47FACnE=; b=DkwlF2Zczp1iX/QwOCLmur4LL75XiKgHuzlHUzO0LPh5GHHTgN5lNJhIBaRAaavVjG o1prpSycECsFHSQRbbuim9WbqOHdi98WpKl33rHzZp07Sqp4cxBGj4sIheZJEIy/8r0a It9b0YYUr73QSt8XOhbplpXT0yJZvlfWl+NlFvxZXaNOL1NTdXu6wF4PgzF1Eq8LLlhj crgGANfcOXI9qq+w668Gfj3LCr1QaFl9ulS7FGJ9NNGWbOLaC5uy3wiKs8yAaHjH7eTE uXXVxovJseOOOm9kbSKf8REGVTY/+9uLMTSyj+x+ZDIcwa/C0dK1mSPVOPCI9SEKH3h9 es0g== X-Gm-Message-State: AOJu0Yys1tePBXM9FCZJBA1YiK8WrLk03HR+oCRLpIevsB5o0o9H3hRY Di5pMDW3EKsZD7biA+svBMQPiA/spP6QOrqDETonzqetxl0= X-Received: by 2002:a5d:6e82:0:b0:336:7d12:caf3 with SMTP id k2-20020a5d6e82000000b003367d12caf3mr1547672wrz.44.1704469715876; Fri, 05 Jan 2024 07:48:35 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id t1-20020adfd001000000b0033672971fabsm1602690wrh.115.2024.01.05.07.48.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 52/71] memory: Simplify memory_region_init_rom_device_nomigrate() calls Date: Fri, 5 Jan 2024 16:42:45 +0100 Message-ID: <20240105154307.21385-53-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, arg5, arg6, errp; @@ - memory_region_init_rom_device_nomigrate(mr, owner, arg3, arg4, arg5, arg6, &errp); if ( - errp + !memory_region_init_rom_device_nomigrate(mr, owner, arg3, arg4, arg5, arg6, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-10-philmd@linaro.org> --- system/memory.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/system/memory.c b/system/memory.c index 8db271c19e..c6562f5e86 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3627,12 +3627,9 @@ void memory_region_init_rom_device(MemoryRegion *mr, Error **errp) { DeviceState *owner_dev; - Error *err = NULL; - memory_region_init_rom_device_nomigrate(mr, owner, ops, opaque, - name, size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom_device_nomigrate(mr, owner, ops, opaque, + name, size, errp)) { return; } /* This will assert if owner is neither NULL nor a DeviceState. From patchwork Fri Jan 5 15:42:46 2024 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: 760219 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109715wru; Fri, 5 Jan 2024 07:58:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGa2BvzZorNrSe9BBYYtFx9KS9qUa205BY0RyiHwplShqE7vnPwZvdqXEWV327WcTgLrosQ X-Received: by 2002:a05:6214:20a3:b0:680:d229:f02b with SMTP id 3-20020a05621420a300b00680d229f02bmr2706915qvd.58.1704470333644; Fri, 05 Jan 2024 07:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470333; cv=none; d=google.com; s=arc-20160816; b=Dv7GSnm4KD88Z1sWZIhQm7zZknlfeC7NYOgqCrXiIQhSMtXZa8qQrr5w2VwVGsVFR1 YtPgbt5gOaD3ljkUoErZ2Rp4//dZEOOvb8P7fCDIvmSVEC5aetTdUf3ofQZ1iXVdi1en Ei0+SJQAV19Sq5eDeMm2M6I8OcQt/Ne8fZCASOGlJvuuF4sFYjXDEpxgD4ltQUaAGMDC XbyIdSOSHLKV9uy1erUEnYqtZJgLw30yMIBWlmONIf70RyWsAEKYSqFeDpVa+JBDsyLx vI/lA726aWYVmqgYE24phpfCUS0h8E8akbKxZmzmwxoyxM1DxMWtrktqjbuc8bm2NTnI Oxkg== 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=p7B3Mf2i+vPlyYoqstgqm0gsIkR8x0JtmN/V8QC/eVg=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=YqntWnnM/p/9nm6Ur1SIznTk2W/UOF/4xiQEvJhrF8QfzSHxrp8mav0r1w4Ngy+79H pMv6sRgk5snqh5A7uGRu0xaxQPlXVpRgGbNsnFJKNeG523tKYBk644v2uK9egXYjJFva 4ZL0i3M0p0nxxQvVyrVMQwBKlkp9CNTYPVZpygIHe5B0P2yO07/jVvmnSfggraz9uHkG Xdtp/a3hApC3SxzNI2dxv5ZBMGaa3RFdE3IfulHnnGwLmub9zQtmrZ8QkEVTtcv2zCMS YHHPdNu1X99u4BmIVDClGjEaTULfMhS9Onr70kymKRklg5ySz1OchoGathC7ZjYdB6BY ENuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cdLnvVql; 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 a10-20020a0c8bca000000b00680503eb91bsi1997759qvc.165.2024.01.05.07.58.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:58:53 -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=cdLnvVql; 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 1rLmRX-00064g-Fi; Fri, 05 Jan 2024 10:49:07 -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 1rLmRB-0003TT-UF for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:46 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmR8-0006Lo-QA for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:45 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-336c9acec03so1302926f8f.2 for ; Fri, 05 Jan 2024 07:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469721; x=1705074521; darn=nongnu.org; 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=p7B3Mf2i+vPlyYoqstgqm0gsIkR8x0JtmN/V8QC/eVg=; b=cdLnvVqlynralpvs1HCYe6v256jrxlMu+z79oOS/fgwnfJMv3D7f38wmCsBG0oSPvW pdCXlhwHrFqZe3RkuEh23fi/jq0gG0zW3ht2225OLehC8oxO4O+ugXUfRkNjyKCpCHRi HjBwxRSOfos1jAoa4TzBFJiE/0poYZiHJ+KwLwebj1zfuPskmDX0oA9Bwvg8zJGoU5Z6 eg+R0EBYynKmiADOH9TBtJ2gYm+UvPOd83eBZXWRp/jDmIcUrJmWpdc4H44HvJ/YRJyM T/MXuEI3Gm2OJNSfJ08vhfI4KOHLk8jjalmesmw3sB/PrD19W8BaBBT9NbbuFaqtDieb NjTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469721; x=1705074521; 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=p7B3Mf2i+vPlyYoqstgqm0gsIkR8x0JtmN/V8QC/eVg=; b=vEs0npBeAqonHmGtdvuQF7V2QAmtx5XZI29JsE+sFk1Mb5xBad11maTQ2jeD5adtHo ywVTL5ICVos7SThb4gSgCaDGMqhyyvInPpIpZlfqAnw8iuKLQK/yQ7xLDgEuEkuxKuyZ zRA6mMx8Kv0+bF6JLiLEO83Hk+dGE5KS7oAILjhD9HI1JtK62BmHwpUuSbSyChvxU/ny A49uEzPiEH7E7juHHZWbSf5xeAlwCoISyihR17p3I10aIWpDMo+pVIPy2zL6QeDG9KQT QHHd7g/TFs0DIrUoIUuAc1DExyTyMyjBYuAQ8hYKr1Tvo82eKtrQ4sSgmLQ/Z8rzTev2 Hujw== X-Gm-Message-State: AOJu0YySzjQAKeZomiQESu0LYyAlbGCcy5BqOfzkCM2jF0WRVMQp9gwF QRd+zPIEHOay9bLvr9ZQXVhVINCNo/zPZfYvM/TZYLIbJDs= X-Received: by 2002:adf:ef81:0:b0:336:70ed:4cc with SMTP id d1-20020adfef81000000b0033670ed04ccmr1129456wro.95.1704469721129; Fri, 05 Jan 2024 07:48:41 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id df14-20020a5d5b8e000000b0033677aae2e2sm1601439wrb.107.2024.01.05.07.48.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 53/71] memory: Have memory_region_init_rom_device() handler return a boolean Date: Fri, 5 Jan 2024 16:42:46 +0100 Message-ID: <20240105154307.21385-54-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_rom_device return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-11-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 6d7b49b735..6209458f56 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1646,8 +1646,10 @@ bool memory_region_init_rom(MemoryRegion *mr, * must be unique within any device * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_rom_device(MemoryRegion *mr, +bool memory_region_init_rom_device(MemoryRegion *mr, Object *owner, const MemoryRegionOps *ops, void *opaque, diff --git a/system/memory.c b/system/memory.c index c6562f5e86..e5193d4623 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3618,7 +3618,7 @@ bool memory_region_init_rom(MemoryRegion *mr, return true; } -void memory_region_init_rom_device(MemoryRegion *mr, +bool memory_region_init_rom_device(MemoryRegion *mr, Object *owner, const MemoryRegionOps *ops, void *opaque, @@ -3630,7 +3630,7 @@ void memory_region_init_rom_device(MemoryRegion *mr, if (!memory_region_init_rom_device_nomigrate(mr, owner, ops, opaque, name, size, errp)) { - return; + return false; } /* This will assert if owner is neither NULL nor a DeviceState. * We only want the owner here for the purposes of defining a @@ -3640,6 +3640,8 @@ void memory_region_init_rom_device(MemoryRegion *mr, */ owner_dev = DEVICE(owner); vmstate_register_ram(mr, owner_dev); + + return true; } /* From patchwork Fri Jan 5 15:42:47 2024 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: 760181 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp106156wru; Fri, 5 Jan 2024 07:50:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6xa7zntb4gV/Rvua/ZcEd/chhAXJP78r5pxM1g1xbLuUKryilUeTzO0wbCLIUgZTcWhph X-Received: by 2002:a05:6122:3281:b0:4b6:cc19:42dc with SMTP id cj1-20020a056122328100b004b6cc1942dcmr2178183vkb.11.1704469813564; Fri, 05 Jan 2024 07:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469813; cv=none; d=google.com; s=arc-20160816; b=KmWzjuoqSd1hDwOjYsb0GroGAMYytTvcJJwZAqj1EmswvJQVGN6Jn26+bgYBah9NK/ 55EMMbVS/am5h9gDMc0qJbPzrmFzc+p/18RkWm6Mk79W4T5MLScAJFGmtcg96hi2o0Iv 7EuWGH7a6T2Ux2jm4Nufe30RSJMKCbdJP3mxOieeFDPKCspRpd6o/T6nYkU553V73jsU ltVL0DRDZT+bFWoBJFtUHBzsDM84tmv5hb4sKgiVkdM+n38hAy2LwZCKnAnBaWa6YWxf prVPKNszth0c1VUQZBvgPXSDMtTWuzgDGiUvoDkLWP6Tib/lqMKX6MDB4+vNViaEWYIf 5Gyg== 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=KS/EWIqcckkOMDkJJEhaku50ApzyYMzhGT/LMkqQfVg=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=KLzjVGfZAyPg7wV7HFaN64qQnaiEy4Yy/ULdcEZcvwwaTUXGdra5AM4gC3go+stCYJ EZeRaC/R/Rl/HgRct8LoCXQlGGEQv5FopCETzSTca4/UVKzbMxoHbOXV5JPzS6WHBZQA xIo19vyWAgFKiJlDlf3sh7YPaJEoIH9AIb3lJdOLlv1uahkhmADyBdDnqU5svbZFZe74 b/ptbOcQZZxwtKkdzucTIH2l4e3UPXU5oj6SEvUYn5a6UBfyc/DqxNxlIumB9pwobwsY SCCQ4UOyBaZOHAFy5wP4HXkXRnYIdosg0Y59olN/pwXcHEaaULvuJIG9QW06wVmjE1bx lNPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TQKmNGjJ; 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 bk29-20020a05620a1a1d00b00781e281bed5si2128194qkb.267.2024.01.05.07.50.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:50:13 -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=TQKmNGjJ; 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 1rLmRh-00076m-Sl; Fri, 05 Jan 2024 10:49:18 -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 1rLmRI-0004Ko-89 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:52 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmRE-0006e3-NY for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:51 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3368ae75082so386061f8f.1 for ; Fri, 05 Jan 2024 07:48:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469726; x=1705074526; darn=nongnu.org; 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=KS/EWIqcckkOMDkJJEhaku50ApzyYMzhGT/LMkqQfVg=; b=TQKmNGjJDide/9Oo07D/i+Oegvwn/RSRSI59Ceub2ho3TaO4cn2Trm+/h85KIULEd1 uDo5PXFPKWCOEzscu1P9ttuVXBZbwVNDAyjazNoxIz6bs9uh5n6L9Wdbk53e0vIKic2f 56NfS7iUqm11yTHxUGYKJUF8SckZo04uXXfIZ4tmhaZw9du/4fhE+RzBZbQHatM/GT/q 1l3E2+VlQ5P/PZBdTbGquBCt56l9XE/7Ec3IarLInKDq7MNcp1TPMIcC/6LOgfgrNhCm inJoRD0PGS3Nbrybxa58hlv+Y5GU2V3V5+8gambOdZszPyG7T+QBcOgIzR1cpMbP2v5K O2kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469726; x=1705074526; 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=KS/EWIqcckkOMDkJJEhaku50ApzyYMzhGT/LMkqQfVg=; b=mlNml2t9fPDrFbwcAP/Y7vAjI2s+lMmqAMnxc3nDvHYwcrpaDVw1bNP79VxPZVS4qX pnYXCXAA7CSFNejF6XbuzIRc0GogqqjjQIoN3WdBws5iEvMGB15hIwxhnSz5IcUVcK90 dHNlCu+plis9wzjxTzolvFtMzH34wGckZv9cu2McisdmSqGjiqokbDlHuVrlwqUjN8jR w9qg5s70H0QzG1yI7uQ07N8DqqE226Yu/SWEwGnUNMdhNlOwpvJFYfrIAvyyH3A8qpFc myNlUgoKfflRfXLMbb9aqsIEcdbw30mT+jiXRyXP0yVnrfG49YGyq4M+cbn5AILZF0uI vbGg== X-Gm-Message-State: AOJu0Yw9WfBDID21mGeRmY3rWjh7acYcKVp/07h2MgBxHfAOvA+vIyMc QinssGrq3jkst5n4SmC9Jkx7nIPmZWUXijpXc2Jm8IzDJWI= X-Received: by 2002:a05:600c:1ca4:b0:40d:8bc8:3566 with SMTP id k36-20020a05600c1ca400b0040d8bc83566mr1247666wms.145.1704469726365; Fri, 05 Jan 2024 07:48:46 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id jb13-20020a05600c54ed00b0040d86e89abfsm1891493wmb.43.2024.01.05.07.48.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 54/71] memory: Have memory_region_init_resizeable_ram() return a boolean Date: Fri, 5 Jan 2024 16:42:47 +0100 Message-ID: <20240105154307.21385-55-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_resizeable_ram return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-12-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 6209458f56..faddf8f073 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1342,8 +1342,10 @@ bool memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, * * Note that this function does not do anything to cause the data in the * RAM memory region to be migrated; that is the responsibility of the caller. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_resizeable_ram(MemoryRegion *mr, +bool memory_region_init_resizeable_ram(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index e5193d4623..75303484e1 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1578,7 +1578,7 @@ bool memory_region_init_ram_flags_nomigrate(MemoryRegion *mr, return true; } -void memory_region_init_resizeable_ram(MemoryRegion *mr, +bool memory_region_init_resizeable_ram(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -1599,7 +1599,9 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr, mr->size = int128_zero(); object_unparent(OBJECT(mr)); error_propagate(errp, err); + return false; } + return true; } #ifdef CONFIG_POSIX From patchwork Fri Jan 5 15:42:48 2024 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: 760198 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107607wru; Fri, 5 Jan 2024 07:53:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHwi1pQFknAYW6kTfU/k0QWaalXPm6Gdeq45JzpPGFIDAiBYHIxg7ZMgsEYObRSIQ1efrsZ X-Received: by 2002:a05:622a:4cf:b0:427:a6c3:ec1d with SMTP id q15-20020a05622a04cf00b00427a6c3ec1dmr2224680qtx.90.1704470013266; Fri, 05 Jan 2024 07:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470013; cv=none; d=google.com; s=arc-20160816; b=UF6sKdwwWczM4qR4rwemQRtDWqV9YWdAE3TMAdiKcG9+uIsGnYxuMujTxNnifr4u5N vzL/iApcMPCufPGy2KuVY7OACAa8Y9eKA/xHHF+/CST4B/Jc3HLuLCY40yEU25NNGI20 WMO0MKZ0Eh3fK2dXmn83adfTDJnbw+w40YiJjDu5nEd5nJFHmAgUC5b+NmfNjiuaOhOo piT5otqL7N3ytVXDXSGAxT5EqyUTOAdsUcrDplcqsPbysUwRHAkRHvBIJlzISLnldpfB eTncidOixMOmPgQykGFJQhAG+Xdw02cf0Jr90ZGcvpjv5H7w0oaHZWRVq5xGn8Y9zWxC 3+kQ== 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=Dn8kXCOFTNbdwpGvjXbfKLmnnB9Pg2Sf7+jbS80Xsv4=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=0ukp/GOWXJuizAJls3WR6AjI5KlVWCkKirqxF/1kW1jhS3Ztrq7+TrnotTbhV/90VW dxgUKZoien8oTcW6asSr9Ikfwf6T7o5PK1ALKkcgYNkV5ZN5Zi5p3kFI4H3176ppPC8+ rEUJTQ//55TG7WhgMLH2ptDzmEtcqmhvfYbz180qviANrYEsSyOpwgqCNHZAvRmmulAN F2z+N8Hjm7C9sSEtgGSvtTH+hZm38r67o6IupJZXqUirkgkkb6jJbs+6qp7NehzUR/y4 /ELsHlt8uE/ec9bjz/YF3bncUUG2zy5vbWbYhigdj6r7LMNof65jvGuW5nJmVC5Vta0b b+dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yNiFcMBI; 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 v16-20020ac85790000000b004297595bc29si1973318qta.488.2024.01.05.07.53.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53: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=yNiFcMBI; 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 1rLmSB-0007vn-Ny; Fri, 05 Jan 2024 10:49: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 1rLmRN-0004lj-F1 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:57 -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 1rLmRJ-0006pj-IN for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:48:57 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40d3c4bfe45so14948575e9.1 for ; Fri, 05 Jan 2024 07:48:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469731; x=1705074531; darn=nongnu.org; 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=Dn8kXCOFTNbdwpGvjXbfKLmnnB9Pg2Sf7+jbS80Xsv4=; b=yNiFcMBIatYGftSM5AGjnqdqSpfEHnDy0FfkdPfkcA3QBAZqmMnGBqeBzlsFTr2uQA IhgxgWfVc9rCH7BBJTfpjlcrVGgw0l64eNy4TFI6L+8I+jpZV06K1GBtBYD98GkLEAXD qGT4HFCkKhvspbG5gm8GeP1CNPhSg9oX84gGMvSZl0n2UpdFYLMSLsMXCBtO0xGQnLut tYxq82Ldsg2P2ZwEwx3Tun/iuoVrz3Jp3iAtvaq4GRvpFtqJOf6FslqMHWfk7owGRQXb yVrdQQ6UKNKEmnCA18hpoqfl0yZKMi8BZCHQApcWUegyXfVju59biFNGDKnT3l6a/Td5 mJbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469731; x=1705074531; 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=Dn8kXCOFTNbdwpGvjXbfKLmnnB9Pg2Sf7+jbS80Xsv4=; b=VE/s0+bCtObAlYZsoMQPINfnCZdVah/KZvIfMpuoXaCDla6G23uAK1yU4MkEbjquKZ A6logmrJONtdx+MGoWUF89gT+paxFnLn7urbNWNHGdoCaJo2Q+uDWhK5H1EhBSRw5sW+ ZEJ2mwDZJaSXtNPBnsm/Y8S3KhhqGi3lhi/TvSEo3NW34fuoC6eyPJVLP30dayaFL8y2 TLmnMJBH219IKSfyESFB4YvvDJHgQXdiItUYhmzVp3WjBHb+R6HUIJwsbO+GMtyEJdoG 8NQq0Kpye8NM7szhmHR3clKxK4AZHRlS0k4LAx96O01YK5Ja85MEVIvd5opYWg8tYg9m 6SRQ== X-Gm-Message-State: AOJu0Ywp9xYd7vTAvta3U0exKBLDWETCKp/JgOxL7IlMUUmHY7MSvV91 XGlkP1sXMIJis02hnRsSOBQlkGTOZdzwKV0wvFd/pj4zvLw= X-Received: by 2002:a05:600c:5188:b0:40e:375f:6929 with SMTP id fa8-20020a05600c518800b0040e375f6929mr311928wmb.40.1704469731598; Fri, 05 Jan 2024 07:48:51 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id s7-20020a5d6a87000000b0033680f7be5fsm1610144wru.87.2024.01.05.07.48.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 55/71] memory: Have memory_region_init_ram_from_file() handler return a boolean Date: Fri, 5 Jan 2024 16:42:48 +0100 Message-ID: <20240105154307.21385-56-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_ram_from_file return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-13-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index faddf8f073..c39819ec75 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1376,8 +1376,10 @@ bool memory_region_init_resizeable_ram(MemoryRegion *mr, * * Note that this function does not do anything to cause the data in the * RAM memory region to be migrated; that is the responsibility of the caller. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_ram_from_file(MemoryRegion *mr, +bool memory_region_init_ram_from_file(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index 75303484e1..e05d88aa67 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1605,7 +1605,7 @@ bool memory_region_init_resizeable_ram(MemoryRegion *mr, } #ifdef CONFIG_POSIX -void memory_region_init_ram_from_file(MemoryRegion *mr, +bool memory_region_init_ram_from_file(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -1628,7 +1628,9 @@ void memory_region_init_ram_from_file(MemoryRegion *mr, mr->size = int128_zero(); object_unparent(OBJECT(mr)); error_propagate(errp, err); + return false; } + return true; } void memory_region_init_ram_from_fd(MemoryRegion *mr, From patchwork Fri Jan 5 15:42:49 2024 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: 760192 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107179wru; Fri, 5 Jan 2024 07:52:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrNFDe64jUK53aXK9fU1GBKUJAb0V4/clShNsLsmrWlUU7XyKZGHcVRTRgKx5hBSU9A1ID X-Received: by 2002:a37:c449:0:b0:781:5750:1c8b with SMTP id h9-20020a37c449000000b0078157501c8bmr2219259qkm.92.1704469962055; Fri, 05 Jan 2024 07:52:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469962; cv=none; d=google.com; s=arc-20160816; b=EoIGm/2heUe4PllPGg0yIMVOfGCkxN/U3K4MjN4JhGfYFmqeykA5bvIdxKEKiRClMO gE+TRviS2NZS+6hBaB0g0NcY/gjljsLR7zRXpQ8OvykBipcmqxu1zkXQRI/hEZrw2PKE LBAO9mkZ2CTvOzWlZNyjs8FsruvSVGM8zfPJjubAdRO5iw7C4cWchCHiQ8JyMeJtmBkm /1efPON7EvdqyySZ5uj3iBzrHVzG7GFOjPMls8SDuQBwqk5u0SI4F6wjLm4PPRd9Bsua RvOrtnLseyhLLZ++uEM/rRXKlWYrrIAPvFbT5I/cMb4gxWlsvGA80+xr/XEIOP7fmsWX 2g4A== 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=c9DCMj7pY2pO17D+FqBvL8kwEDleUW00T3E/JGiYz/k=; fh=81NhLE2m/KZ6CtPYKaqP63dEzTQeY0b9aypae7xj+Rg=; b=xboZXWvzMU8EISw3iBUhYTIXEenhMTbZgpakjgV3n9MszNIXtQOgZ1sr5E6ogYhUNB 4DaPzmURRGtW7DnTDkJhYgMDsYneMOMQNoY7VuRkpMaeWspG7PKZTGy+gBUpZl+Ojz84 FLhIe22Gay2nmzsuecYpYDoQss0Z8e3EPX0qqiywneEVwrUaxnp4HH+yNjOa0UekEjiX l+cS8lG3mgCXVbfhv47tSg6vxr48bqdwCtUmHnJXFEH+Voj3k1qs2LLBQP16vGLTpBFG Njfi/GrrwErOBIqMgiV7Agl2qNo+gvc0/B7k7PJAx7SRktsnWe0t07pKfRvUO7h+irkO JqGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U54if9m0; 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 os47-20020a05620a812f00b007811ac158fasi1891661qkn.214.2024.01.05.07.52.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52:42 -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=U54if9m0; 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 1rLmT2-0001mb-3l; Fri, 05 Jan 2024 10:50: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 1rLmRg-00076c-81 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:17 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmRO-00075k-OG for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:14 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40d8902da73so12882625e9.2 for ; Fri, 05 Jan 2024 07:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469737; x=1705074537; darn=nongnu.org; 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=c9DCMj7pY2pO17D+FqBvL8kwEDleUW00T3E/JGiYz/k=; b=U54if9m0B4jYXM4rDTogAYwijQfmaWRbyeNV7pFxhFHddn9l0IDHgqC9Cilhz5VgDl bQn7UZX+V4CFJNfZFyhm7isRTf7+aIu9AXB1alsa3icILbPnLv1oyhOXMhzZlLSgi9Z4 BOIBinMngYba1t1jnPZP805CP73T5tad2dPqgWOzkksGNGezv2eUco/wmNgY5R9a5+Uf Mw9BuSBNuYOTc3qGMWOsOFjZwi/mP8UC7zcUgSnJnKoRS9LWQdnr5npbPDzoa6j4EkLG x32opXu7JdXwIg70Uivz7cchEEeQIGslAjeCFyDb0zRXUTRYb6/WZszJ0vKSj10N1atN ouFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469737; x=1705074537; 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=c9DCMj7pY2pO17D+FqBvL8kwEDleUW00T3E/JGiYz/k=; b=l9viSW/ap+y1D8WleuMeROaMG8xcMNKJ6p4BAn/GMO8S5HvS5r2KX4s11WbfMrWe+1 I4hsjBra6G5hmZGszb1Mg8Ye+3802BgakXM45Zx4Xz440sLt77/NBDUY2M9v/0AvBxiF IlKKxZUB33FKoBNVRU4iVvxzYzzuqWtCEwkGYwks8x76uw5201kzluz2dM3RqhSA+gkf dsWgyh1CKQdAVa17bj5/x5Udbql+5ewjPbN3cJvgkzvTEkfk5hvDe0yq10O++7bv9Fzv HF+w0h1TyNyuPGHT32Dnsxe/HDoJUN3KqUw/STvGCdgqGkBc1uTJkPydBFQar7NnSOxJ KEaA== X-Gm-Message-State: AOJu0Yxmyqh6hxQP8cy1GzTgjWVfGpnX82pSH5K+4aPx+QneG0bI7gMm dNu4wU/TPMHWiXtF2FTsRKSU2guukRHIgYTABDWgRtY1pR0= X-Received: by 2002:a05:600c:4a13:b0:40d:8ddc:b443 with SMTP id c19-20020a05600c4a1300b0040d8ddcb443mr1540873wmp.50.1704469737001; Fri, 05 Jan 2024 07:48:57 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id az29-20020a05600c601d00b0040d87b5a87csm1965144wmb.48.2024.01.05.07.48.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:48:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , David Hildenbrand Subject: [PULL 56/71] memory: Have memory_region_init_ram_from_fd() handler return a boolean Date: Fri, 5 Jan 2024 16:42:49 +0100 Message-ID: <20240105154307.21385-57-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have memory_region_init_ram_from_fd return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-14-philmd@linaro.org> --- include/exec/memory.h | 4 +++- system/memory.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index c39819ec75..48c11ca743 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -1406,8 +1406,10 @@ bool memory_region_init_ram_from_file(MemoryRegion *mr, * * Note that this function does not do anything to cause the data in the * RAM memory region to be migrated; that is the responsibility of the caller. + * + * Return: true on success, else false setting @errp with error. */ -void memory_region_init_ram_from_fd(MemoryRegion *mr, +bool memory_region_init_ram_from_fd(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, diff --git a/system/memory.c b/system/memory.c index e05d88aa67..9ceb229d28 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1633,7 +1633,7 @@ bool memory_region_init_ram_from_file(MemoryRegion *mr, return true; } -void memory_region_init_ram_from_fd(MemoryRegion *mr, +bool memory_region_init_ram_from_fd(MemoryRegion *mr, Object *owner, const char *name, uint64_t size, @@ -1654,7 +1654,9 @@ void memory_region_init_ram_from_fd(MemoryRegion *mr, mr->size = int128_zero(); object_unparent(OBJECT(mr)); error_propagate(errp, err); + return false; } + return true; } #endif From patchwork Fri Jan 5 15:42:50 2024 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: 760202 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107659wru; Fri, 5 Jan 2024 07:53:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFt8YIp0YTKVx/DyugwKuS4eGGH2E57sH6ZxhhSiv24pgkYtpmRkbvBU1eu9QU/IA84aEW X-Received: by 2002:a05:6214:27ce:b0:67f:cb74:3566 with SMTP id ge14-20020a05621427ce00b0067fcb743566mr2826334qvb.5.1704470020374; Fri, 05 Jan 2024 07:53:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470020; cv=none; d=google.com; s=arc-20160816; b=DT0NVBNWZJRo7J6B/9IWGPoHsKIXQ0e8I/Pnk5mTbg9qMNRA3ERT7VNj8z/wSwhdjW yoabHjVH1B65DbMLv8qlgJeobocWdbgSlWwAdlXO5HdSvCh7ZgOapTIJmOtokHvstXEM CxjL/bjI0b9YOiWd7084DXOL8Wh2H/zJ0HHlmORjRazdNcSSRh5/VTLYB9eZt1MgTTGU 641kL6Z/daj5QDQ7pXDxhzPiivIS5vz9KpYtFWOYyTWV/a1BDLaRLna/TXZ9NBJXxRqh /8KDPu2eTRDEYElA6ttiNbkzcsmcAt9GaNjQ+PpwPxMxHMS+KLg6FgdK4VE8Iy02VKoa a6aA== 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=/MHct3O8aNA/2/UVwnbSfbe+2Bg3uf1okl2NSMgEytw=; fh=9e/GdPOc9kaFcZwUUs4wJrMLrLita2N4fbrPz9ApZsQ=; b=kctlCPaB1dsLyJsZUV5u9wo7/78gQYF694iJdv0ra5FBZn5lggvhf5hEaJaQ3xJImK /l5bs0tabMg3n5b/LGLT9iK/KttGD7ozsuCaw3d68c1p/Rjm0YOMN+3vsG084ycJsVth YMsxFf32b/UTuppklYO+ZD3TUbGK4C9ITTLKwxFRLMyWekfl2CZB99Qw5uaotoDxGw9j LNsiz1uTh3I+y/invKcl8LPZV6KFFR/X1qpOIMIbj9p2x/Wy6k4J1/yxnM8us9gUPYsT MqSV0MgEiIb2KbhwyZG1htEM/wV+KfFcqIOYDdn4vRIwcs9uSpzopIPnDzllSr2dYOHi EVvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RDI1Rcxa; 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 sq22-20020a05620a4ad600b007817087ecf4si1908434qkn.415.2024.01.05.07.53.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53: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=RDI1Rcxa; 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 1rLmRr-0007Uv-Mm; Fri, 05 Jan 2024 10:49:27 -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 1rLmRY-0006Hv-GP for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:08 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmRU-0007Ks-3l for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:08 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3366ddd1eddso1512714f8f.0 for ; Fri, 05 Jan 2024 07:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469742; x=1705074542; darn=nongnu.org; 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=/MHct3O8aNA/2/UVwnbSfbe+2Bg3uf1okl2NSMgEytw=; b=RDI1RcxaxyKuatpifuVlVk6C8weM19gQADJK+wWa/W8BqYpddrTeT39IE8QJ04aJ1Q o+7WitPm8Qj++IzirnQ1Qa3zC8eMvjp827JfBQbuk7ABH4xnY07Ki71DL51XhtxoDQ3M wgtbbJ7vQVBEL//1D+a6Sy0cy2ewN5LUCs/8akLrgUvb5BCT5R1pxMJ384O6nP1DN6Ds wct+R5/zeElK2Tj693/ZdvdqkNwTtbN/PVKDu3phXgTDvEoBFl8EhiuiLEEgRD100H0G K56bgZ4UaRf8oFvCQ0BUKAwh+oQ8nyGitPySgZZlHE/3rOQnAcQIBSo/TXmEP5pHM7WH oqdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469742; x=1705074542; 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=/MHct3O8aNA/2/UVwnbSfbe+2Bg3uf1okl2NSMgEytw=; b=dtqbR7WqRWR0eypXQ5VDlpbH6xoHJBkzgYiQKfwn0NsiQ1/XaQ74wsYrAuZ4yspeON 589t4gSjepkhtBLMLiy72pWmZ9rJoBap8xgiGQUoB34puQruJfJDeTVAxor9uT0Wa071 de7GjwQmkkKGtwLoyqb2c2e03ClUdtZNhANON/Tefxou5oMgzHGo0yiFsIb8PoDaciZO QiMakxMAK8uro+kkobJDdcqQyiGWt5jZ6to2I7nCsxnu0Y6oxE2uG6wvQeFlcIFfSFy1 nDhdfIbYxGC0xQ39JdrQN9VyJJvjg3SZhQai1jP+7rR+fNr0N9DTwslxEvonTYvvocr2 +g6g== X-Gm-Message-State: AOJu0YyFKU8OOkcyRHgNjWoBvXklBCtQIYODWmuOyIxd+cizfm9Uj5Kh RW92EkILihhQgRVS+0GfvTlJhOlIdxapGhVCZTz5El5qmcE= X-Received: by 2002:a05:600c:4583:b0:40c:a5b:d28b with SMTP id r3-20020a05600c458300b0040c0a5bd28bmr634654wmo.86.1704469742377; Fri, 05 Jan 2024 07:49:02 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id z6-20020a5d4c86000000b00337464bf723sm1611623wrs.18.2024.01.05.07.49.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , David Hildenbrand , Igor Mammedov Subject: [PULL 57/71] backends: Use g_autofree in HostMemoryBackendClass::alloc() handlers Date: Fri, 5 Jan 2024 16:42:50 +0100 Message-ID: <20240105154307.21385-58-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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, T_SCC_BODY_TEXT_LINE=-0.01 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 In preparation of having HostMemoryBackendClass::alloc() handlers return a boolean, have them use g_autofree. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-15-philmd@linaro.org> --- backends/hostmem-epc.c | 3 +-- backends/hostmem-file.c | 3 +-- backends/hostmem-memfd.c | 3 +-- backends/hostmem-ram.c | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/backends/hostmem-epc.c b/backends/hostmem-epc.c index 4e162d6789..3ceb079f9e 100644 --- a/backends/hostmem-epc.c +++ b/backends/hostmem-epc.c @@ -20,8 +20,8 @@ static void sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { + g_autofree char *name = NULL; uint32_t ram_flags; - char *name; int fd; if (!backend->size) { @@ -41,7 +41,6 @@ sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, backend->size, ram_flags, fd, 0, errp); - g_free(name); } static void sgx_epc_backend_instance_init(Object *obj) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index 361d4a8103..fe8c481f8f 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -44,8 +44,8 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) object_get_typename(OBJECT(backend))); #else HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(backend); + g_autofree gchar *name = NULL; uint32_t ram_flags; - gchar *name; if (!backend->size) { error_setg(errp, "can't create backend with size 0"); @@ -89,7 +89,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), name, backend->size, fb->align, ram_flags, fb->mem_path, fb->offset, errp); - g_free(name); #endif } diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 3fc85c3db8..db28ab5a56 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -35,8 +35,8 @@ static void memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { HostMemoryBackendMemfd *m = MEMORY_BACKEND_MEMFD(backend); + g_autofree char *name = NULL; uint32_t ram_flags; - char *name; int fd; if (!backend->size) { @@ -57,7 +57,6 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, backend->size, ram_flags, fd, 0, errp); - g_free(name); } static bool diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index b8e55cdbd0..0a670fc22a 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -19,8 +19,8 @@ static void ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { + g_autofree char *name = NULL; uint32_t ram_flags; - char *name; if (!backend->size) { error_setg(errp, "can't create backend with size 0"); @@ -32,7 +32,6 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; memory_region_init_ram_flags_nomigrate(&backend->mr, OBJECT(backend), name, backend->size, ram_flags, errp); - g_free(name); } static void From patchwork Fri Jan 5 15:42:51 2024 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: 760191 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107164wru; Fri, 5 Jan 2024 07:52:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdeXRhG4ajsmCUp6OKUBWlQ8eVQbo/N0n1aSN9xi4Wjw8dtt+MAUq5Ky3biaG61paXCleV X-Received: by 2002:ae9:c30c:0:b0:781:e427:c877 with SMTP id n12-20020ae9c30c000000b00781e427c877mr2332116qkg.94.1704469959850; Fri, 05 Jan 2024 07:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469959; cv=none; d=google.com; s=arc-20160816; b=auhgqwaVRXgHm7kkUM22oiBMEbMr8OcjxzhaVp6vLsvyVW7MnKDeKOcWy96X64O71s LhQbk/kuMwDZtQx+gpAaiqRytvj6j/LsbMbCJX8gxlZAxf9zdOyJKszxlZZL1FwggozT mCcSEmd+ArfZZYW1TM3S/Reuz777J1gXsoDdKf7CwTlqVn7jLyH7jOpDb/TK6WfOwc2J bKzIOZUlOR6BxEiXukfTNXsYpys3uaTGGeqEjmr+ee82FxO4Yrk4U7g1AHJ8gUf6Htj5 gzWubf8rxPFsRVBs3/5cp2p/GE/1u6M+5B531h8JMN2FkMmPCQ/6SWWX8ljorOsL6DCY MnrA== 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=Ux8OTSc8Ad9jOVNGlPCxH1dshjQrIfyvWA7mV8zeD70=; fh=9e/GdPOc9kaFcZwUUs4wJrMLrLita2N4fbrPz9ApZsQ=; b=Dj8VnGwgJ4XON0ZvB5SZz/JrJSnGVhXNlvNITLhvo7qxmjxNyzdJKgg59c/p9eyQLu HZbx0FQlmqRbBMYSXOOVyAXUoffg9TaJyF9OzKvmOxldSVovC45Fs/G9Y66jgQy6xAeT at6r8NzqrU8lsffiMi6ByLiz2391CfK9b1RTswJ4z44Hk2EdNq1040xJK/v/fsW7fIyV RimKfN7Q5HU/kmXiCTceBgIS0TNVJKqp/03/ki2eADhVYpYIxkTp7W4VUEUSuVH6yAcW fFcLsJmkrDd6vGY6si1RQ81XUmoqUSi6dsB3g+dZDDvShyIfJHiMli/cdTp9sea1UIXv 2izQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KvLiuHot; 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 m22-20020a05620a291600b007830acce9a6si1214289qkp.378.2024.01.05.07.52.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52:39 -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=KvLiuHot; 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 1rLmSY-0000eJ-Md; Fri, 05 Jan 2024 10:50:11 -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 1rLmRd-00074G-7i for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:16 -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 1rLmRZ-0007fu-LZ for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:12 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-33686649b72so1473637f8f.3 for ; Fri, 05 Jan 2024 07:49:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469748; x=1705074548; darn=nongnu.org; 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=Ux8OTSc8Ad9jOVNGlPCxH1dshjQrIfyvWA7mV8zeD70=; b=KvLiuHotPLFzDY5cGRIYlx7MzPpNJHtlWFKoRlRM92gtTF6gcJZHZFac9pzvl+4OjA 5Y7TUBAgkt91UmhVpooMo3vFLsXkW3/L6pLDFmvOgwc1KiL5P3AntWTx+NUqLz9coDyk mvDzDYMpREBNgkwfKy/w9196OppRfEOwe1TJ6tHtldw9W1wufNkcbzOFzR1HxJfb9bO3 r79ie326Qqf4mbWYFWkRaGuDfFFsrR8E0gf6FqgTAUwZtTaPJCMV3NVcUWdGfNvjwC4o nUVBfbVrHyZ732LbSWFdfHcPw3nXUut+r4dkawPydxjoMBIKh7PiKS5uSu6oV2u0Hto8 s3xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469748; x=1705074548; 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=Ux8OTSc8Ad9jOVNGlPCxH1dshjQrIfyvWA7mV8zeD70=; b=hhCfOeKjAYo6mPFS8hSTFokyUhrM3sKtymZ+azbKwRa5ir6MlO9R9rksbCAULdb6e4 8nKsEF7jkTy5hL4rxTDqOJluJPtgasnx3qDP3RDRcGIDaoSYh8Ew+Dq8mEJ+3t0r0vQt rjlVG9CmjA8ioxHfdJJkvM1g3Dptjc56Tz0OhRlz//sjZUT39KlJ0XdJHIS+VvG3EXk+ qV7gZWe4p4/kjOoqXhyGL4o9oT13hqihOw4j6Je5yEwucvkrSprNG3f/Mjl2gyW7tiyT JRrXay3UjTW8g0zirKNrca4hvvpRGqReDHnnccODRsnqzKQNaVQ+/WMTavGCqZyYp6az 3iYg== X-Gm-Message-State: AOJu0Ywij7XlZHUCJq6hYexSvCNraDs8SSyuE814E7szxuhXKy/+9QIK KOGy05pjc8Y4EbDjCceZ0zvB0fQIaE7kicKxTPQ3bk5j8xA= X-Received: by 2002:a5d:4a84:0:b0:336:7bd0:47a2 with SMTP id o4-20020a5d4a84000000b003367bd047a2mr1392275wrq.112.1704469747954; Fri, 05 Jan 2024 07:49:07 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id v11-20020a5d4a4b000000b0033755d8ce7asm1612139wrs.76.2024.01.05.07.49.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:07 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , David Hildenbrand , Igor Mammedov Subject: [PULL 58/71] backends: Simplify host_memory_backend_memory_complete() Date: Fri, 5 Jan 2024 16:42:51 +0100 Message-ID: <20240105154307.21385-59-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Return early if bc->alloc is NULL. De-indent the if() ladder. Note, this avoids a pointless call to error_propagate() with errp=NULL at the 'out:' label. Change trivial when reviewed with 'git-diff --ignore-all-space'. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-16-philmd@linaro.org> --- backends/hostmem.c | 133 +++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 66 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 747e7838c0..1723c19165 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -328,83 +328,84 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) void *ptr; uint64_t sz; - if (bc->alloc) { - bc->alloc(backend, &local_err); - if (local_err) { - goto out; - } + if (!bc->alloc) { + return; + } + bc->alloc(backend, &local_err); + if (local_err) { + goto out; + } - ptr = memory_region_get_ram_ptr(&backend->mr); - sz = memory_region_size(&backend->mr); + ptr = memory_region_get_ram_ptr(&backend->mr); + sz = memory_region_size(&backend->mr); - if (backend->merge) { - qemu_madvise(ptr, sz, QEMU_MADV_MERGEABLE); - } - if (!backend->dump) { - qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP); - } + if (backend->merge) { + qemu_madvise(ptr, sz, QEMU_MADV_MERGEABLE); + } + if (!backend->dump) { + qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP); + } #ifdef CONFIG_NUMA - unsigned long lastbit = find_last_bit(backend->host_nodes, MAX_NODES); - /* lastbit == MAX_NODES means maxnode = 0 */ - unsigned long maxnode = (lastbit + 1) % (MAX_NODES + 1); - /* ensure policy won't be ignored in case memory is preallocated - * before mbind(). note: MPOL_MF_STRICT is ignored on hugepages so - * this doesn't catch hugepage case. */ - unsigned flags = MPOL_MF_STRICT | MPOL_MF_MOVE; - int mode = backend->policy; + unsigned long lastbit = find_last_bit(backend->host_nodes, MAX_NODES); + /* lastbit == MAX_NODES means maxnode = 0 */ + unsigned long maxnode = (lastbit + 1) % (MAX_NODES + 1); + /* ensure policy won't be ignored in case memory is preallocated + * before mbind(). note: MPOL_MF_STRICT is ignored on hugepages so + * this doesn't catch hugepage case. */ + unsigned flags = MPOL_MF_STRICT | MPOL_MF_MOVE; + int mode = backend->policy; - /* check for invalid host-nodes and policies and give more verbose - * error messages than mbind(). */ - if (maxnode && backend->policy == MPOL_DEFAULT) { - error_setg(errp, "host-nodes must be empty for policy default," - " or you should explicitly specify a policy other" - " than default"); - return; - } else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) { - error_setg(errp, "host-nodes must be set for policy %s", - HostMemPolicy_str(backend->policy)); - return; - } + /* check for invalid host-nodes and policies and give more verbose + * error messages than mbind(). */ + if (maxnode && backend->policy == MPOL_DEFAULT) { + error_setg(errp, "host-nodes must be empty for policy default," + " or you should explicitly specify a policy other" + " than default"); + return; + } else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) { + error_setg(errp, "host-nodes must be set for policy %s", + HostMemPolicy_str(backend->policy)); + return; + } - /* We can have up to MAX_NODES nodes, but we need to pass maxnode+1 - * as argument to mbind() due to an old Linux bug (feature?) which - * cuts off the last specified node. This means backend->host_nodes - * must have MAX_NODES+1 bits available. - */ - assert(sizeof(backend->host_nodes) >= - BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long)); - assert(maxnode <= MAX_NODES); + /* We can have up to MAX_NODES nodes, but we need to pass maxnode+1 + * as argument to mbind() due to an old Linux bug (feature?) which + * cuts off the last specified node. This means backend->host_nodes + * must have MAX_NODES+1 bits available. + */ + assert(sizeof(backend->host_nodes) >= + BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long)); + assert(maxnode <= MAX_NODES); #ifdef HAVE_NUMA_HAS_PREFERRED_MANY - if (mode == MPOL_PREFERRED && numa_has_preferred_many() > 0) { - /* - * Replace with MPOL_PREFERRED_MANY otherwise the mbind() below - * silently picks the first node. - */ - mode = MPOL_PREFERRED_MANY; - } + if (mode == MPOL_PREFERRED && numa_has_preferred_many() > 0) { + /* + * Replace with MPOL_PREFERRED_MANY otherwise the mbind() below + * silently picks the first node. + */ + mode = MPOL_PREFERRED_MANY; + } #endif - if (maxnode && - mbind(ptr, sz, mode, backend->host_nodes, maxnode + 1, flags)) { - if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) { - error_setg_errno(errp, errno, - "cannot bind memory to host NUMA nodes"); - return; - } + if (maxnode && + mbind(ptr, sz, mode, backend->host_nodes, maxnode + 1, flags)) { + if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) { + error_setg_errno(errp, errno, + "cannot bind memory to host NUMA nodes"); + return; } + } #endif - /* Preallocate memory after the NUMA policy has been instantiated. - * This is necessary to guarantee memory is allocated with - * specified NUMA policy in place. - */ - if (backend->prealloc) { - qemu_prealloc_mem(memory_region_get_fd(&backend->mr), ptr, sz, - backend->prealloc_threads, - backend->prealloc_context, &local_err); - if (local_err) { - goto out; - } + /* Preallocate memory after the NUMA policy has been instantiated. + * This is necessary to guarantee memory is allocated with + * specified NUMA policy in place. + */ + if (backend->prealloc) { + qemu_prealloc_mem(memory_region_get_fd(&backend->mr), ptr, sz, + backend->prealloc_threads, + backend->prealloc_context, &local_err); + if (local_err) { + goto out; } } out: From patchwork Fri Jan 5 15:42:52 2024 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: 760221 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109863wru; Fri, 5 Jan 2024 07:59:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEybbxZbW0zYPmOjPcCPQ8NOQL7wsNnARnxtFo334d2HraTVH7GGl2ME+JrV/9f0zCO4u3E X-Received: by 2002:a05:622a:182:b0:429:7ab1:8c7e with SMTP id s2-20020a05622a018200b004297ab18c7emr805330qtw.57.1704470355683; Fri, 05 Jan 2024 07:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470355; cv=none; d=google.com; s=arc-20160816; b=dlVwKowF/BW33Gi7PJsQjshNLQR08iTHEJ704Q8DWBUlRKLsnfVxW3hNHt20nIden4 yW7qn85j6L3NUXSAseuhEDEFr1fpXTVNGNwOZsoZa4YhAsetccIhGx4Rw1YO7rnl9aRI 9xVo8xQI5YOd/2F0mdrlIboTJw4t3obJmUPDUHm1cAOLXBWK5l25nHB6ewI3/WX9lbWI nUlj4BXR9/e2GIiUIC8OYmcp7SehdinwW9Rl5Dl/LAOOwfbmxMqPCgN9qZeadk04MwDj XxxTs7avvwDfFi9MgZzarvKc2WVjttFvJJg18oEpTZuXKiSmS5DmM84aNsMx+nrucWXE g86A== 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=QjTvneZAUBkosxG1nWDJT6FQx8ULASKYfEukRB1XIpY=; fh=9e/GdPOc9kaFcZwUUs4wJrMLrLita2N4fbrPz9ApZsQ=; b=bLd6Tf8Y2asPU/m8t2qQLG3RT+Rl2MV6s/sOiES4Ewbl5sEiNooc78jgGU2Yk2O8MJ SeHhDP484A/TYZasQq3DwkKdEIzn1G3FQZ5ppx3cUukVninNTRSnO1j8IFHkOrARLe5+ ue8UsCxTYxdg3P1f9Aj2VnXS39cEkBox6J7J1pqakDx9ubhUIKjklhYgsSnZ4c9C0d6V EMHRo9fQskce+fJqMHCxFNsLAIOptlqTTSG10i8Yp2Gxb4Hh8BapuYNn9N18iShqsftx D06Rv0kU0DviqAb9EYBlx2cvJLyZYgceNpSA7cYMtb9GiK71jBVl7POFJuVxgMLawwmV jClA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bSQdDuDM; 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 bs20-20020ac86f14000000b004297b9c0f12si964954qtb.515.2024.01.05.07.59.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:59: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=bSQdDuDM; 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 1rLmTK-00027C-40; Fri, 05 Jan 2024 10:50:58 -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 1rLmRj-0007Fm-GE for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:21 -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 1rLmRg-0007rh-0o for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:19 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40d60ad5f0bso19751205e9.0 for ; Fri, 05 Jan 2024 07:49:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469753; x=1705074553; darn=nongnu.org; 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=QjTvneZAUBkosxG1nWDJT6FQx8ULASKYfEukRB1XIpY=; b=bSQdDuDMsgO/iZ7Fv9m7PW1eB1csUPd557FC0hOWYAaQUFFp4CgsNcrld3qtjxo33U 5xl0ooX9IAXb9CkG+vfzsd1r7askWZsZ0TEIfq+cVAZyWJXK3zSAjPCSMihaEgdKdCbq CrzC0L0+LF8+UM6muz9jwO05cZwZBuvfNCMUp4wi4H8sWFL25wfyu25T8gDso1w7m716 /Y4FNurtrXC0vdtBfRHO5+8u+NXAfGDrnIzAOVCBvyMf/NSExPf+ZLflb1DkMtvY3Cn7 SckIjMm2AWqtqtrOcnUfsS3DAl5kYIDKkToDANQWK5+TNOm526/PRjTZgsgOppk2zYRn k+Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469753; x=1705074553; 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=QjTvneZAUBkosxG1nWDJT6FQx8ULASKYfEukRB1XIpY=; b=f1RTneF3tW+BPP+7+XWdbSY11WGbgy7WYDEk/fB4h6xv5+UFE7a+EIK80hhRjmjxLD b3ws6dpoQCKZ9FmJoUmq7el6j2+qjXKuQnAxjGaicNF87J1YYocRIP7SuC/YyRNgmA0n 9lGfM04Sd4XbE7Br7VwsoFkYIgceGZ74cBym4/MFlY2/eRLkTURaiQsyRav1hG1rce5G kcKDWVQwEksto94Rf7rPrRxfG2oNZ+OzLPILFF3eGkkJq4O/6qWry4sOO6h08yCYo248 HB/CX6zcLhSbc2Nu25efxJdM+Paa24oO6ZprgTQarfHYmUj8wOmwurAOWt4q1zmZpR/u m0gw== X-Gm-Message-State: AOJu0Yx9sUDOs9vV7nZoZX5uhNuK/FUQtoqeh27UrJFcr1nvu3WtHqmb r0X2KjYsIQg1DXWeSmNL9WtW/QzaVTYRrV463cEgYV2sT9k= X-Received: by 2002:a05:600c:3b1d:b0:40d:91fd:74e with SMTP id m29-20020a05600c3b1d00b0040d91fd074emr1369672wms.15.1704469753430; Fri, 05 Jan 2024 07:49:13 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id t9-20020a05600c198900b0040d6d755c90sm1937955wmq.42.2024.01.05.07.49.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , David Hildenbrand , Igor Mammedov Subject: [PULL 59/71] backends: Have HostMemoryBackendClass::alloc() handler return a boolean Date: Fri, 5 Jan 2024 16:42:52 +0100 Message-ID: <20240105154307.21385-60-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_FILL_THIS_FORM_SHORT=0.01, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have HostMemoryBackendClass::alloc return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-17-philmd@linaro.org> --- include/sysemu/hostmem.h | 10 +++++++++- backends/hostmem-epc.c | 11 +++++------ backends/hostmem-file.c | 19 ++++++++++--------- backends/hostmem-memfd.c | 10 +++++----- backends/hostmem-ram.c | 9 +++++---- backends/hostmem.c | 5 ++--- 6 files changed, 36 insertions(+), 28 deletions(-) diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index 39326f1d4f..0e411aaa29 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -47,7 +47,15 @@ OBJECT_DECLARE_TYPE(HostMemoryBackend, HostMemoryBackendClass, struct HostMemoryBackendClass { ObjectClass parent_class; - void (*alloc)(HostMemoryBackend *backend, Error **errp); + /** + * alloc: Allocate memory from backend. + * + * @backend: the #HostMemoryBackend. + * @errp: pointer to Error*, to store an error if it happens. + * + * Return: true on success, else false setting @errp with error. + */ + bool (*alloc)(HostMemoryBackend *backend, Error **errp); }; /** diff --git a/backends/hostmem-epc.c b/backends/hostmem-epc.c index 3ceb079f9e..735e2e1cf8 100644 --- a/backends/hostmem-epc.c +++ b/backends/hostmem-epc.c @@ -17,7 +17,7 @@ #include "sysemu/hostmem.h" #include "hw/i386/hostmem-epc.h" -static void +static bool sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { g_autofree char *name = NULL; @@ -26,21 +26,20 @@ sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) if (!backend->size) { error_setg(errp, "can't create backend with size 0"); - return; + return false; } fd = qemu_open_old("/dev/sgx_vepc", O_RDWR); if (fd < 0) { error_setg_errno(errp, errno, "failed to open /dev/sgx_vepc to alloc SGX EPC"); - return; + return false; } name = object_get_canonical_path(OBJECT(backend)); ram_flags = (backend->share ? RAM_SHARED : 0) | RAM_PROTECTED; - memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), - name, backend->size, ram_flags, - fd, 0, errp); + return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, + backend->size, ram_flags, fd, 0, errp); } static void sgx_epc_backend_instance_init(Object *obj) diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c index fe8c481f8f..ac3e433cbd 100644 --- a/backends/hostmem-file.c +++ b/backends/hostmem-file.c @@ -36,12 +36,13 @@ struct HostMemoryBackendFile { OnOffAuto rom; }; -static void +static bool file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { #ifndef CONFIG_POSIX error_setg(errp, "backend '%s' not supported on this host", object_get_typename(OBJECT(backend))); + return false; #else HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(backend); g_autofree gchar *name = NULL; @@ -49,11 +50,11 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) if (!backend->size) { error_setg(errp, "can't create backend with size 0"); - return; + return false; } if (!fb->mem_path) { error_setg(errp, "mem-path property not set"); - return; + return false; } switch (fb->rom) { @@ -65,18 +66,18 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) if (!fb->readonly) { error_setg(errp, "property 'rom' = 'on' is not supported with" " 'readonly' = 'off'"); - return; + return false; } break; case ON_OFF_AUTO_OFF: if (fb->readonly && backend->share) { error_setg(errp, "property 'rom' = 'off' is incompatible with" " 'readonly' = 'on' and 'share' = 'on'"); - return; + return false; } break; default: - assert(false); + g_assert_not_reached(); } name = host_memory_backend_get_name(backend); @@ -86,9 +87,9 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; ram_flags |= fb->is_pmem ? RAM_PMEM : 0; ram_flags |= RAM_NAMED_FILE; - memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), name, - backend->size, fb->align, ram_flags, - fb->mem_path, fb->offset, errp); + return memory_region_init_ram_from_file(&backend->mr, OBJECT(backend), name, + backend->size, fb->align, ram_flags, + fb->mem_path, fb->offset, errp); #endif } diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index db28ab5a56..3923ea9364 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -31,7 +31,7 @@ struct HostMemoryBackendMemfd { bool seal; }; -static void +static bool memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { HostMemoryBackendMemfd *m = MEMORY_BACKEND_MEMFD(backend); @@ -41,7 +41,7 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) if (!backend->size) { error_setg(errp, "can't create backend with size 0"); - return; + return false; } fd = qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size, @@ -49,14 +49,14 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL : 0, errp); if (fd == -1) { - return; + return false; } name = host_memory_backend_get_name(backend); ram_flags = backend->share ? RAM_SHARED : 0; ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; - memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, - backend->size, ram_flags, fd, 0, errp); + return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, + backend->size, ram_flags, fd, 0, errp); } static bool diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c index 0a670fc22a..d121249f0f 100644 --- a/backends/hostmem-ram.c +++ b/backends/hostmem-ram.c @@ -16,7 +16,7 @@ #include "qemu/module.h" #include "qom/object_interfaces.h" -static void +static bool ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) { g_autofree char *name = NULL; @@ -24,14 +24,15 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) if (!backend->size) { error_setg(errp, "can't create backend with size 0"); - return; + return false; } name = host_memory_backend_get_name(backend); ram_flags = backend->share ? RAM_SHARED : 0; ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; - memory_region_init_ram_flags_nomigrate(&backend->mr, OBJECT(backend), name, - backend->size, ram_flags, errp); + return memory_region_init_ram_flags_nomigrate(&backend->mr, OBJECT(backend), + name, backend->size, + ram_flags, errp); } static void diff --git a/backends/hostmem.c b/backends/hostmem.c index 1723c19165..3f8eb936d7 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -331,9 +331,8 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) if (!bc->alloc) { return; } - bc->alloc(backend, &local_err); - if (local_err) { - goto out; + if (!bc->alloc(backend, errp)) { + return; } ptr = memory_region_get_ram_ptr(&backend->mr); From patchwork Fri Jan 5 15:42:53 2024 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: 760215 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109158wru; Fri, 5 Jan 2024 07:57:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGllD1s0T6BSCnewpVeQatrYg34c5kyGkFmarFetWeRDeb81AeSqZhhsqulEKinjBCcBOvO X-Received: by 2002:a05:6214:29c1:b0:680:c9b1:1a2a with SMTP id gh1-20020a05621429c100b00680c9b11a2amr2264481qvb.45.1704470243758; Fri, 05 Jan 2024 07:57:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470243; cv=none; d=google.com; s=arc-20160816; b=JYQfr7szMi1lM9qsfgGmZMc9EU+ei7+ni+SeNXGFAAYLmDazQSienal/WkL89jSvEz so3l9om9WdcTqhEoy7yGG7Z0sbzMDlleih+tI9/FWDtdLEd2DPzwy2r0h3feyW3zz5sm upVtOuXkzXD09J0/n7zkBJxxYxf+OKDG5SjDSrATw7zAzVuJCt+BRjddQv5h0BG4++VU g6yQWUQaACCJEittTOymkoJ9gNDhWdEbQnWhNaerUwllYkLa1+wVgZPoUy0r9vqYqf1s S4IhPAdC5+e3SXEA62xF1CKg2XxM3v2SoggVG4pCYR5Ox7Houwo24nudugK4R4n7hsy+ Wgpg== 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=3HnuyTIxGYsWykQsG+bF/A0ZdepEt+u1/qeWfQkxoXY=; fh=9e/GdPOc9kaFcZwUUs4wJrMLrLita2N4fbrPz9ApZsQ=; b=IsbqBbxlcw9WJ16QkZaVp0hujdJBorvhAxWWEHD6LSpFA8d41VAU+yVVEnB+E4W10b 97xVMVs0mDHqfHooqPzMhemrKMZFMa1G32hNMdzRKRtJoohfvew9i8lG6oJTgizDoJKC oWdZ/hB8GhKJRzvbs4hS3iS6KYAPBm2BYygC3pecZqchYHv8hnTVzvRhw/xS3+eEHdmD 9YO9p1fDD66kbJsuFggiUroZF8AvvUbOc9ksDpYL2/PGqpWQ+j4Fjpq8RbWgHluviHJ/ nO8f4LHNorPZWYoVoQLSt9U4RuuYpqM1DphMbKgo0/EzHjac7dXz4ak9U0RzTfKV/tZa yjDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W5IRGN+q; 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 o15-20020a0ccb0f000000b0067f8d88de06si1963216qvk.471.2024.01.05.07.57.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:57:23 -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=W5IRGN+q; 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 1rLmTR-00036j-QB; Fri, 05 Jan 2024 10:51: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 1rLmRo-0007aX-48 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:27 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmRl-00089l-If for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:23 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-336990fb8fbso1225269f8f.1 for ; Fri, 05 Jan 2024 07:49:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469759; x=1705074559; darn=nongnu.org; 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=3HnuyTIxGYsWykQsG+bF/A0ZdepEt+u1/qeWfQkxoXY=; b=W5IRGN+q6DxEAK7IZ142Yb6IQ7SyaNnnL42Zi3OjH8BHb3APSAzo3/QcBLKwzXUKdk e6Mkz9HGBxDx8rVeGuNK2jOtNrjL0jAVeMGBY7b2XLo4Tayr6136TGASp/O5c0jggpU4 gZaycS75NjgbR9dsRwT2ir3octbXCuBd6/nG9ecY2wsaqg7GDDwoLKApGOfJpkBNCV6x A5cGl5zFNSDisVBRiwrszNVn2k9W4dhBq4kh1W+odEl5du13AmPIQ/NQPdH31CABblza SeIxHR2/ZEjEu18tLg62ds9RFn9qD3EXRiZvHn6uNqoXJJiYpqdBUWfmT7aBx2ZiZKg2 EBUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469759; x=1705074559; 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=3HnuyTIxGYsWykQsG+bF/A0ZdepEt+u1/qeWfQkxoXY=; b=N8iBysN30TQDDqWQAItx/QTNI2zbR0RFGZKCI7vn/adUuHaLoSLIQOQOBsYDy7fRZW Flb1FINRwJkd1RFqQlJ2Z1hyFF0pnxE64skORu4l+ZJmr858j/p0sCTquHtnZLk48K3i +AhernaE8pCoOVGgf8Mrx/rINjGJiX6KzDAt/K5mv5U1nSC7k28m2h5Jlq+E344bisft Hh7BisJOWL+lgdARr3Yz7QwYnaThX0MB3/MRKPOS5vArO9WD4QXaw3XfGfAsxLYrI9/o lz2ZH1r3XMCQgv44hoIKYqbhkULF9kM8+FXRnbOTMLGtTbBxGW7SkQMlSu9yRKiwzb5A O16Q== X-Gm-Message-State: AOJu0Yz7hufI6i0Wpe00aRRrRDtpYcNt2LzCx5GKJzY48rarW/hnwb9L sk04k6P7TB/CONUtVPSJkThFIOvp8CEIx7maku576/P/XYk= X-Received: by 2002:a5d:5cc3:0:b0:336:e399:6fc7 with SMTP id cg3-20020a5d5cc3000000b00336e3996fc7mr1040828wrb.59.1704469758884; Fri, 05 Jan 2024 07:49:18 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id k4-20020a5d6284000000b00336c43b366fsm1618203wru.12.2024.01.05.07.49.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , David Hildenbrand , Igor Mammedov Subject: [PULL 60/71] backends: Reduce variable scope in host_memory_backend_memory_complete Date: Fri, 5 Jan 2024 16:42:53 +0100 Message-ID: <20240105154307.21385-61-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Reduce the &local_err variable use and remove the 'out:' label. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-18-philmd@linaro.org> --- backends/hostmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 3f8eb936d7..1b0043a0d9 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -324,7 +324,6 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) { HostMemoryBackend *backend = MEMORY_BACKEND(uc); HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(uc); - Error *local_err = NULL; void *ptr; uint64_t sz; @@ -400,15 +399,16 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) * specified NUMA policy in place. */ if (backend->prealloc) { + Error *local_err = NULL; + qemu_prealloc_mem(memory_region_get_fd(&backend->mr), ptr, sz, backend->prealloc_threads, backend->prealloc_context, &local_err); if (local_err) { - goto out; + error_propagate(errp, local_err); + return; } } -out: - error_propagate(errp, local_err); } static bool From patchwork Fri Jan 5 15:42:54 2024 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: 760220 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109826wru; Fri, 5 Jan 2024 07:59:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqhE1bnVw7PHz3XhaDqsN/6//d3BSRvAh2m3OMoV4jzTSMgHod4Gh8DGb7vFP2WAFzaBwe X-Received: by 2002:a9d:77d6:0:b0:6dc:2aa:822f with SMTP id w22-20020a9d77d6000000b006dc02aa822fmr2240249otl.30.1704470349683; Fri, 05 Jan 2024 07:59:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470349; cv=none; d=google.com; s=arc-20160816; b=dpK2nRSdmAkPXDkNgh1rylR0L9SqkM440tiTUrW+3HNfh6OBnLn4+uArkLSu3NMX03 haDq+ZiSoQllgdxajsQbj3/VzGAGM26Ebgh5nT19brPH+8Uh0A3L0yj8tJZs72A5zq+n i4ZY1ag4w2v7haU4AwMlUaFzRtCcM9S1HBAgLmhobtVm+N41siARQXsXZC6vybL5PKTv Z8BB6cnh7iWGXprMDusEnLAQE+rE1VbjtTp7aPeqoOTr+wekcungiuRnPezAaVh5pKyT v9PRAoq2L4SmZkmm8TIetbagYhbjTdvoAsUUCmHP36ep2BXFRNAnUhhn6egRV+Migymz 4R+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=X1UceGM9JMyf+mvn5Vqfm2bFDJfnlw6Hthf90m+0+RM=; fh=P6daQqniyYPoLBFy1SCvSyZnaCi7XKZAHvbWeRxCTRQ=; b=UU8pCuhxcTcQ8fFwJNQITYjfphpuA0JLnHkgtg8I2c9VqE/tkugupIzEeo4CYUIiH/ WR2bDzgQsDBgR+4myxvUfLUKTkxlXqSOh4S0S+zasf6I6udoLrBN/PH89hzp21GfL6Dm Z2YZH22fYmYpnOc8Y0plGIF0Xpyc1pkcGp7KxfYoWnBAkOPG6t7nECMMr5phcHdaP92D WqfURsDV4F+jWIye2nc/RjbDJIr3v6ju755sUQgJ3o1MzI+LLURh0Mcgm9JUz0zHxvAu HS2QKL5qNm0VhRNkeOJGhO6xSMoPnVgU30KY+7Bxmvmx3OERdwRAnRC3+NsPGLt1Cyq2 Y3HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uz3+Keve; 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 i4-20020a05620a248400b007814aa8eaedsi2177642qkn.108.2024.01.05.07.59.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07: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=uz3+Keve; 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 1rLmTO-0002oc-TC; Fri, 05 Jan 2024 10:51:03 -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 1rLmRt-0007kW-3w for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:30 -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 1rLmRq-0008ME-2U for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:28 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40d2376db79so13010785e9.0 for ; Fri, 05 Jan 2024 07:49:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469764; x=1705074564; darn=nongnu.org; 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=X1UceGM9JMyf+mvn5Vqfm2bFDJfnlw6Hthf90m+0+RM=; b=uz3+Keveir5GfCNNPI4bKaz/IJviY0QjaiHfbycrEa3nNitGKCHtXLcEG7wGWqhwWN jWYM/6Ziz+NElFCvid4OHeIU70L0VL9A3JHaSiCBE7DXXVC3DmWwJhWf5GCpnj9D3dwO BBL/L1aRVNdR6wvDbbHxpFg42BY4BbiUFdQWg+irIS9J/fuMW3kv5DxSxkTegPANxkq9 +9ofRqjBB4gwTuMFk20jSoXKMZT1dJ28zm0WtVsW8Ku8oaDcNnEGz69xmjn2DJrNXnaG /8SsBr2w/p8mxe+lqUP5t3oMs4nEOhUD9DHpNyADmyEybbRJWkThlqOvgDFFYtO98Zu2 2thA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469764; x=1705074564; 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=X1UceGM9JMyf+mvn5Vqfm2bFDJfnlw6Hthf90m+0+RM=; b=G3g+9malKF6cKP179piJxGw6ZxtYREoYtkxnCM5BmV+FWgmc7xFXnKYe+Bv4W4beTQ SfFus5Q7yj8CnZeyIQsxW35aKUoAueHlerDyUBilnL5bZ0sE4x9BZCq/QRVIUKHp9x7R S2tRvGL6v+yJk7ZS70qQLwp5+A4+9YgS0n+ouneRWA8ZfK09zw2ecim+FGCNOmE0Mntd Ca8GkDkD3+0DsU8Cq3swuCF/hpG3jzSXNHXEDGVGezwFkYhP8D1AhAqBeOpvAOHCF440 9CLywyx8Sih9wLh7fmdoJ+NAwjoxMMWdUJia0C9tQc18+CDFZ85CEPJGHal7ddEUaBfC iCvg== X-Gm-Message-State: AOJu0YygvahTLq+2UpKmA4U1s8JuOBenp+hyUmemz+Va0lqtzeBGM5nl nLt67cB/CK4ZZ8elSi9TvMbt4JB5IKAYSEM8AQQyuqIGsRQ= X-Received: by 2002:adf:e9d2:0:b0:337:39c7:48 with SMTP id l18-20020adfe9d2000000b0033739c70048mr1522360wrn.1.1704469764364; Fri, 05 Jan 2024 07:49:24 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id d10-20020a056000114a00b00336710ddea0sm1618390wrx.59.2024.01.05.07.49.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:24 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu , Gavin Shan , Paolo Bonzini , Stefan Weil Subject: [PULL 61/71] util/oslib: Have qemu_prealloc_mem() handler return a boolean Date: Fri, 5 Jan 2024 16:42:54 +0100 Message-ID: <20240105154307.21385-62-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have qemu_prealloc_mem() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-19-philmd@linaro.org> --- include/qemu/osdep.h | 4 +++- util/oslib-posix.c | 7 +++++-- util/oslib-win32.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index d30ba73eda..db366d6796 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -678,8 +678,10 @@ typedef struct ThreadContext ThreadContext; * memory area starting at @area with the size of @sz. After a successful call, * each page in the area was faulted in writable at least once, for example, * after allocating file blocks for mapped files. + * + * Return: true on success, else false setting @errp with error. */ -void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, +bool qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, ThreadContext *tc, Error **errp); /** diff --git a/util/oslib-posix.c b/util/oslib-posix.c index e86fd64e09..7c297003b9 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -497,7 +497,7 @@ static bool madv_populate_write_possible(char *area, size_t pagesize) errno != EINVAL; } -void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, +bool qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, ThreadContext *tc, Error **errp) { static gsize initialized; @@ -506,6 +506,7 @@ void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, size_t numpages = DIV_ROUND_UP(sz, hpagesize); bool use_madv_populate_write; struct sigaction act; + bool rv = true; /* * Sense on every invocation, as MADV_POPULATE_WRITE cannot be used for @@ -534,7 +535,7 @@ void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, qemu_mutex_unlock(&sigbus_mutex); error_setg_errno(errp, errno, "qemu_prealloc_mem: failed to install signal handler"); - return; + return false; } } @@ -544,6 +545,7 @@ void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, if (ret) { error_setg_errno(errp, -ret, "qemu_prealloc_mem: preallocating memory failed"); + rv = false; } if (!use_madv_populate_write) { @@ -555,6 +557,7 @@ void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, } qemu_mutex_unlock(&sigbus_mutex); } + return rv; } char *qemu_get_pid_name(pid_t pid) diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 55b0189dc3..c4a5f05a49 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -264,7 +264,7 @@ int getpagesize(void) return system_info.dwPageSize; } -void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, +bool qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, ThreadContext *tc, Error **errp) { int i; @@ -274,6 +274,8 @@ void qemu_prealloc_mem(int fd, char *area, size_t sz, int max_threads, for (i = 0; i < sz / pagesize; i++) { memset(area + pagesize * i, 0, 1); } + + return true; } char *qemu_get_pid_name(pid_t pid) From patchwork Fri Jan 5 15:42:55 2024 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: 760193 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107210wru; Fri, 5 Jan 2024 07:52:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFe6t7qZy3bClN6PpubWZqT7YXIR8Gmkl0Q5bVwhMdtP++kpFJHTYTD+wznfXXCn1lC1til X-Received: by 2002:a05:6871:2287:b0:1fb:75a:c42b with SMTP id sd7-20020a056871228700b001fb075ac42bmr2025117oab.84.1704469964002; Fri, 05 Jan 2024 07:52:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704469963; cv=none; d=google.com; s=arc-20160816; b=CFCY2nJfFkGQAHfNAuaW88BG7MYcCjo5G+9cPCSfsG09iAsBaPXFBNDCTMfc1oWuKx UEHfRRGDPDuJ/aEBXOsRRpWUXNexI2nKd2o+e6FhowWuyecRzODZMja+y6bjv44IRkNZ LdcN4b9/2qV59xOR8Vti2r7WaWUBxI8yoFJ3sJtchioGoRJ+/rsSlZpiaLQsNMpSYNee m/cm676CkCwt+7VcE2XkO7HfQYXvBm5GIREe70GuyKxLzo0qIk7hxV1jYP8LQMrLToyN 6vvNGFa3fF3dWZZk1GnG3AId6zjPJK5ggaQCp9bj2S2A/HuEDlJbuX+VYTPA01uoxHWR WMjw== 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=Woygxb5I84iWcYNaobFk5BQd3UxVH0KFWr0IJtclL9o=; fh=eZFKaymFlF0IiGi9x96mJ5hjCjorzvf1c0Fe2qPu/mA=; b=lzEiIUUMMgnITx6qpx+HXgxYnaYK5Qes6Dq0yL2lLw+dHHt+5PzoT3UJ8pvWjKCThw fuELF6YJ4ZDMYXVcAYK2JQtwHATp7MVAOCtYZHKtkzfxfowWwKH27T0esX4uBgzV+uW+ Xx4alMczISjCyjXWqa9G7vOvLvELm4y9i1VM3QDGbdP7D5w9aKSrNfj9wnuhzX+iTHND ceb/yrtiwJe66DrY+8LpHtlpVMHKdkcHPMTithbMXKRO2OEqzFiMBr+Df5KuZv2R3F0m /rB78JtJK16Tbns+AXBOZSB5x3habKV1i5yWZlZ2tILj9c7BV8Ixf0M9ANAIQ5EjkHqL eFLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ckxd5aEW; 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 h27-20020a05620a13fb00b00781565afc7esi1890916qkl.515.2024.01.05.07.52.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:52:43 -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=Ckxd5aEW; 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 1rLmSh-00017W-5a; Fri, 05 Jan 2024 10:50:20 -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 1rLmRy-0007o3-VX for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:41 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmRw-0000I0-GL for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:34 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40d5f40ce04so17306865e9.2 for ; Fri, 05 Jan 2024 07:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469770; x=1705074570; darn=nongnu.org; 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=Woygxb5I84iWcYNaobFk5BQd3UxVH0KFWr0IJtclL9o=; b=Ckxd5aEW30HBEabc+kyoDNBFSBgsK9nVKTqm+JR4jlJZiGUiEzLETvaGonHR/xPErY v4JYS+DhetyLJ5Lp9XuaeV69NgP/UrjbUjesSPq5e+d1CirGxcH0QFC+NONjtlZp4lU1 ATEOfPaph8R3nl+29iPXEIWBcJWYnPmQtmHxLaDjnssMb172xzIT/aJauGT9+u9FSJro +ajmymCY8Lb4hMG80nG5M/qYaeIPGgT/KlqqVqfEHHmYFRmP+/40vFOEao9aA8SPG0xQ addq9KrNO2PuhJfkA7SOpU3qV6pBzvQqRgVMXsiVUYtnJb99S/qtEncycLulbYrkCocW 6wrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469770; x=1705074570; 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=Woygxb5I84iWcYNaobFk5BQd3UxVH0KFWr0IJtclL9o=; b=MHRtK8UFl563qUnOnMi1scnHC2AjT9iIuWibDepqe4FIIxzp+hF0M4X7Hm84kzZ/e3 i05GW7L8DDObeLCpVgfMMaXI/wb+KOFmc2n2Lwg7LlV2pC549A0MMW9/cV2+ozbxMotP uh1oYEtcgey8D9GVb3iJyigOsoDhBvHwIOfRQLSzMCFzdabB6R6o7+cnj0S1k5Cwk5fd 0crBK3P5CZpANTG0Xndo6mvsOR7NllC+8fDQeCVrQNu9VAytNtsqDJlPZvvtyJUx9u4q 6vuM6HmgRbxtHJzyuA3RtXiHpOy8xUAbPofVh6NsyawnCHgRhQceYk1Wpca32LVUeAr/ +s1Q== X-Gm-Message-State: AOJu0Yxa/4iYpikvhy3ibeX05ZCaijGAUY6SgHA735h9AgGuspaKFaTq JilbeHPmPZflnuqanU3VzYymFwz0eUk6FzwkafyBOS/+U/Y= X-Received: by 2002:a05:600c:4fc1:b0:40d:fc98:b88f with SMTP id o1-20020a05600c4fc100b0040dfc98b88fmr1258706wmq.49.1704469769865; Fri, 05 Jan 2024 07:49:29 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id t1-20020adfd001000000b0033672971fabsm1603944wrh.115.2024.01.05.07.49.28 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:29 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , David Hildenbrand , Igor Mammedov , "Michael S. Tsirkin" Subject: [PULL 62/71] misc: Simplify qemu_prealloc_mem() calls Date: Fri, 5 Jan 2024 16:42:55 +0100 Message-ID: <20240105154307.21385-63-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 qemu_prealloc_mem() returns whether or not an error occured, we don't need to check the @errp pointer. Remove local_err uses when we can return directly. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-20-philmd@linaro.org> --- backends/hostmem.c | 22 +++++++--------------- hw/virtio/virtio-mem.c | 6 ++---- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 1b0043a0d9..30f69b2cb5 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -219,7 +219,6 @@ static bool host_memory_backend_get_prealloc(Object *obj, Error **errp) static void host_memory_backend_set_prealloc(Object *obj, bool value, Error **errp) { - Error *local_err = NULL; HostMemoryBackend *backend = MEMORY_BACKEND(obj); if (!backend->reserve && value) { @@ -237,10 +236,8 @@ static void host_memory_backend_set_prealloc(Object *obj, bool value, void *ptr = memory_region_get_ram_ptr(&backend->mr); uint64_t sz = memory_region_size(&backend->mr); - qemu_prealloc_mem(fd, ptr, sz, backend->prealloc_threads, - backend->prealloc_context, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!qemu_prealloc_mem(fd, ptr, sz, backend->prealloc_threads, + backend->prealloc_context, errp)) { return; } backend->prealloc = true; @@ -398,16 +395,11 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp) * This is necessary to guarantee memory is allocated with * specified NUMA policy in place. */ - if (backend->prealloc) { - Error *local_err = NULL; - - qemu_prealloc_mem(memory_region_get_fd(&backend->mr), ptr, sz, - backend->prealloc_threads, - backend->prealloc_context, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } + if (backend->prealloc && !qemu_prealloc_mem(memory_region_get_fd(&backend->mr), + ptr, sz, + backend->prealloc_threads, + backend->prealloc_context, errp)) { + return; } } diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index dc4709790f..99ab989852 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -605,8 +605,7 @@ static int virtio_mem_set_block_state(VirtIOMEM *vmem, uint64_t start_gpa, int fd = memory_region_get_fd(&vmem->memdev->mr); Error *local_err = NULL; - qemu_prealloc_mem(fd, area, size, 1, NULL, &local_err); - if (local_err) { + if (!qemu_prealloc_mem(fd, area, size, 1, NULL, &local_err)) { static bool warned; /* @@ -1249,8 +1248,7 @@ static int virtio_mem_prealloc_range_cb(VirtIOMEM *vmem, void *arg, int fd = memory_region_get_fd(&vmem->memdev->mr); Error *local_err = NULL; - qemu_prealloc_mem(fd, area, size, 1, NULL, &local_err); - if (local_err) { + if (!qemu_prealloc_mem(fd, area, size, 1, NULL, &local_err)) { error_report_err(local_err); return -ENOMEM; } From patchwork Fri Jan 5 15:42:56 2024 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: 760212 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp108780wru; Fri, 5 Jan 2024 07:56:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/ZvB3zqzLKDKJ6eWFXmckO4RQnPutosIdB09OzsedaOZnMxYLMD/GtTud1U+yEFkinScK X-Received: by 2002:ad4:5aab:0:b0:680:53c:5e5a with SMTP id u11-20020ad45aab000000b00680053c5e5amr2499282qvg.114.1704470184674; Fri, 05 Jan 2024 07:56:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470184; cv=none; d=google.com; s=arc-20160816; b=zLBY3MofmnPAc9PDC7X2/g8TV1+npjl4aPbYpfeN1qBYhFr86es7ZWZQzNcxb7e9YF 7B07SE1QFj84FZk6mAwm9LFcl0xPyAuIftgevKHIOSCx6Hk/kgwc6W4qPBNBG4aN2xp4 wAUxAJeYJ0MAH3eE91IMDyJOjNFEr6TecX4c2kzG85NB8kuEkLHl1dNzWIl62wcv5CHz uLXDWJpgB8liOk2uKyj3QUYOx/a2uD5vs2IP8ZvPwrg7j0xEsHbJkG710ahjwyiEyQc1 WZ0XBu0r3lajx6IPEzs+SXI258Tadgr77Z5xUlrpT+OZaBclVGOPlYzt04MXtz/CmndJ feHg== 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=/qHj/5uAdYCvRnDozLLxG4HVXbbh9wIM2eiBwuzcy8E=; fh=PC1N9TByiSiFL4HDhxWgbHq+kzV4suSQZA+CstPXMFM=; b=xB4s9SYVoJidpNJ//5whIt2UldhF+7aXcyZJl+VpfoLLAGQ9lGai+k7NSfaIGzZG8u HTkD1hIvVUqmQFlGt8IojnLR0sN8TK7JYl+NKB9tj4UF2g+3axOJhKugRnvmNYbUCx7n 7Kzd2LWf6t/91cqPW4frkw0bN8XTRnTG4SyfCZuSqUh6JnBfn8PYNy6w+O8dCI+FUjvV 9KePVmZ7pI2jyN6kPmXR++i2ZLnVd72KIPcBG//yAS+DJxlM+fRQwMSO8YCfVGUC5i7m 1fzPTaX7a3ieT7MvNZLWHR97GameDOGGGv8tzv8SmW+B3frwiUJ2VmFt+G4sSv+dZyow OY4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O6thLAWU; 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 w8-20020a0cdf88000000b0067f2c23a115si2025111qvl.163.2024.01.05.07.56.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:56:24 -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=O6thLAWU; 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 1rLmTR-00034u-4i; Fri, 05 Jan 2024 10:51: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 1rLmS7-0007pc-HB for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:44 -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 1rLmS4-0000au-TP for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:42 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-336746a545fso411337f8f.0 for ; Fri, 05 Jan 2024 07:49:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469775; x=1705074575; darn=nongnu.org; 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=/qHj/5uAdYCvRnDozLLxG4HVXbbh9wIM2eiBwuzcy8E=; b=O6thLAWUIs+mpGnt3fcHUY2d+6DiM5HlAlAv/iQ7Fr0KqxtaYdnmgujwU5LX4cOHnI TRBPVsIdGacvsdSE4JULGcXZ37MXJyoZMGi2J97hGoOGpnNnppIJbVsShplKGBxtE7K2 Ro+YfmT04YRZ5Oo4QY4PsWJ8Kxm+KywzbePWYvGxTzFUfJGTqeNtoHhiSg4pJqjGlK7r 7nTpn/8XYky0sGBDkaOBw2PjzQZUNNgxrcJt5UbWbUrHP6P2MKL0oypX11k2hMpg/VZP Z1pOnAzb9gCSA1gVhgFS8HM3IkswqKhqFwK4A7P7Fea/yRPYwZDmcjq2SV8bxaOym+io 5kFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469775; x=1705074575; 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=/qHj/5uAdYCvRnDozLLxG4HVXbbh9wIM2eiBwuzcy8E=; b=QOwx7zbq9vj8smNJq0aXfB70+K+RYGNxmr25byXQzme0RPpWAFqXkyaMJLEGRsirhF FUBHv1irj60PzT+Q34+ITdIhB682nXH0GtpGI/PdtG+k2Sc4a2xtqcW4ccLpzCsNce6n SxPSUbBuKLdIpW+6rcmfpEuASF0FgO0hBHpQZabqobliaarE57ttmWEUL2g7rwpWb57X Znq333g/KDoWh1EM5hN0jN9WJHiBis9x/0M/bIlQlfMNjflnfMHIBcgv2siIt1bZYOhQ wWcXJ03VJCclx+D1DSITYP4g/v/T7SjpLri4atSdDzYvMkcNDSsxHqg213dCDG7K7W0h Fsuw== X-Gm-Message-State: AOJu0YybH2z+GqTm9FMBDNeJmVKR81heU/SxB+nYC0G9NsV0FgLm7HGq VOfd/m1UV/4LdkL35oRfTiymlOs+h5KjPk9oK6Yz8g7jjOo= X-Received: by 2002:a5d:42cc:0:b0:337:5c9c:2a52 with SMTP id t12-20020a5d42cc000000b003375c9c2a52mr361625wrr.20.1704469775442; Fri, 05 Jan 2024 07:49:35 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id cs18-20020a056000089200b00333359b522dsm1615912wrb.77.2024.01.05.07.49.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Andrew Jeffery , Gavin Shan , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Joel Stanley , Jean-Christophe Dubois , =?utf-8?q?Herv=C3=A9_Poussine?= =?utf-8?q?au?= Subject: [PULL 63/71] hw: Simplify memory_region_init_ram() calls Date: Fri, 5 Jan 2024 16:42:56 +0100 Message-ID: <20240105154307.21385-64-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, errp; @@ - memory_region_init_ram(mr, owner, arg3, arg4, &errp); if ( - errp + !memory_region_init_ram(mr, owner, arg3, arg4, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Andrew Jeffery # aspeed Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-21-philmd@linaro.org> --- hw/arm/aspeed_ast2400.c | 6 ++---- hw/arm/aspeed_ast2600.c | 6 ++---- hw/arm/fsl-imx25.c | 6 ++---- hw/arm/fsl-imx31.c | 6 ++---- hw/arm/fsl-imx6.c | 6 ++---- hw/arm/integratorcp.c | 7 ++----- hw/arm/nrf51_soc.c | 7 ++----- hw/ppc/rs6000_mc.c | 7 ++----- 8 files changed, 16 insertions(+), 35 deletions(-) diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c index a4334c81b8..0baa2ff96e 100644 --- a/hw/arm/aspeed_ast2400.c +++ b/hw/arm/aspeed_ast2400.c @@ -247,7 +247,6 @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp) Aspeed2400SoCState *a = ASPEED2400_SOC(dev); AspeedSoCState *s = ASPEED_SOC(dev); AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); - Error *err = NULL; g_autofree char *sram_name = NULL; /* Default boot region (SPI memory or ROMs) */ @@ -276,9 +275,8 @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp) /* SRAM */ sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_index); - memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, + errp)) { return; } memory_region_add_subregion(s->memory, diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index b965fbab5e..3a9a303ab8 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -282,7 +282,6 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) Aspeed2600SoCState *a = ASPEED2600_SOC(dev); AspeedSoCState *s = ASPEED_SOC(dev); AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); - Error *err = NULL; qemu_irq irq; g_autofree char *sram_name = NULL; @@ -355,9 +354,8 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) /* SRAM */ sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_index); - memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, + errp)) { return; } memory_region_add_subregion(s->memory, diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 9aabbf7f58..b15435ccaf 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -299,10 +299,8 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) &s->rom[1]); /* initialize internal RAM (128 KB) */ - memory_region_init_ram(&s->iram, NULL, "imx25.iram", FSL_IMX25_IRAM_SIZE, - &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram(&s->iram, NULL, "imx25.iram", + FSL_IMX25_IRAM_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX25_IRAM_ADDR, diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index def27bb913..1d5dcd51e8 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -208,10 +208,8 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) &s->rom); /* initialize internal RAM (16 KB) */ - memory_region_init_ram(&s->iram, NULL, "imx31.iram", FSL_IMX31_IRAM_SIZE, - &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram(&s->iram, NULL, "imx31.iram", + FSL_IMX31_IRAM_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX31_IRAM_ADDR, diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 7dc42cbfe6..58f37e7c11 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -443,10 +443,8 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) &s->caam); /* OCRAM memory */ - memory_region_init_ram(&s->ocram, NULL, "imx6.ocram", FSL_IMX6_OCRAM_SIZE, - &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram(&s->ocram, NULL, "imx6.ocram", + FSL_IMX6_OCRAM_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX6_OCRAM_ADDR, diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c index e602ca5e14..1830e1d785 100644 --- a/hw/arm/integratorcp.c +++ b/hw/arm/integratorcp.c @@ -291,12 +291,9 @@ static void integratorcm_realize(DeviceState *d, Error **errp) { IntegratorCMState *s = INTEGRATOR_CM(d); SysBusDevice *dev = SYS_BUS_DEVICE(d); - Error *local_err = NULL; - memory_region_init_ram(&s->flash, OBJECT(d), "integrator.flash", 0x100000, - &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram(&s->flash, OBJECT(d), "integrator.flash", + 0x100000, errp)) { return; } diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c index 34da0d62f0..ac53441630 100644 --- a/hw/arm/nrf51_soc.c +++ b/hw/arm/nrf51_soc.c @@ -58,7 +58,6 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) { NRF51State *s = NRF51_SOC(dev_soc); MemoryRegion *mr; - Error *err = NULL; uint8_t i = 0; hwaddr base_addr = 0; @@ -92,10 +91,8 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp) memory_region_add_subregion_overlap(&s->container, 0, s->board_memory, -1); - memory_region_init_ram(&s->sram, OBJECT(s), "nrf51.sram", s->sram_size, - &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram(&s->sram, OBJECT(s), "nrf51.sram", s->sram_size, + errp)) { return; } memory_region_add_subregion(&s->container, NRF51_SRAM_BASE, &s->sram); diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c index b35f8ba112..e6ec4b4c40 100644 --- a/hw/ppc/rs6000_mc.c +++ b/hw/ppc/rs6000_mc.c @@ -143,7 +143,6 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) RS6000MCState *s = RS6000MC(dev); int socket = 0; unsigned int ram_size = s->ram_size / MiB; - Error *local_err = NULL; while (socket < 6) { if (ram_size >= 64) { @@ -165,10 +164,8 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) if (s->simm_size[socket]) { char name[] = "simm.?"; name[5] = socket + '0'; - memory_region_init_ram(&s->simm[socket], OBJECT(dev), name, - s->simm_size[socket] * MiB, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram(&s->simm[socket], OBJECT(dev), name, + s->simm_size[socket] * MiB, errp)) { return; } memory_region_add_subregion_overlap(get_system_memory(), 0, From patchwork Fri Jan 5 15:42:57 2024 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: 760206 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107923wru; Fri, 5 Jan 2024 07:54:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdzVcZlKqT7UrxwVNnKYEVX6LDH0+4Oe/VbPVtvGH4/xiMVKzxzyrMaFVbl7KGBpIyjDlF X-Received: by 2002:ac8:590d:0:b0:427:7da3:13ca with SMTP id 13-20020ac8590d000000b004277da313camr2523777qty.45.1704470062682; Fri, 05 Jan 2024 07:54:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470062; cv=none; d=google.com; s=arc-20160816; b=o+JLm926mgS7N6lWXKmb4WVPAPGYdiiacPBe0oQ2skJTXp7TQkU8mcS0JqY/tUWGlg gRGNsvTXsmHLFToH+/fuv50X7/k0BCzlqWcDR8qdTO2frLs1r0yFOnluykT4O1wr+K6n QLXUblXatx52tPu+xvtrUAv4kPtGgCqQjLCajBSlFrMH29HEfeVeklyCiqvNrAhkpELl uwFAxtfwh6D6XxkRtdiXA6MivhqzSmlurRqv9/SZmHx0ahbS7WgGIIWpZytY9rSAPC5u yInh9I3VLwvGkcl0aAqWTVB6vRJJDOERMLex6oT9ZaHBrS2X85e9xe2bFECwdgNdNO2J me4g== 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=WY1HVSmMqBvEYUJRh+Ffc8mXYkbCc4MclKwdMWfHMLU=; fh=ohy7VCZIgAkuFgQBo2ie5XMmNCqja1QqYZPjawlAGKM=; b=v8vCB9/2oQzbIUFLdXZMthO1ei5LvYYkZQPlEMdbwec80/bEcfyXiw2C9i6i+Vmn1L 8RB6ds5d1Kia5Dh1+ig/54fsa4GEyEErJm+fc+SNS9N0apz+nfSrLMOeDLtPfLersQ9Q oRob8jstNU8wbHSteiq+D1sj1091lkzTjEb01XirCWuN+l3+NEXRmSrdJNSZ5F4qlEGb GJxN2+AZmyupcwMBYGy829WNfBOpj1I+O5L28rqJWKO87X7DBYDw+WNkMDpUKt8oL2WX TcFO7QKKfu2b3zUuLGg3thR/YIqQM4/jbYmeUJa3PCAZ6vpTshk3DZ2NWT9605TavT/L X7+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mXagiHF5; 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 b7-20020a05622a020700b0042812a9e5c0si2106758qtx.125.2024.01.05.07.54.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:54:22 -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=mXagiHF5; 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 1rLmTT-0003LH-Gg; Fri, 05 Jan 2024 10:51:07 -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 1rLmS9-0007vo-L1 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:46 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmS7-0000pY-9I for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:45 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3373a30af67so1326527f8f.0 for ; Fri, 05 Jan 2024 07:49:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469780; x=1705074580; darn=nongnu.org; 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=WY1HVSmMqBvEYUJRh+Ffc8mXYkbCc4MclKwdMWfHMLU=; b=mXagiHF54kfdUzGSesLI76REo2QBZplxlc1aW1qLhPd8wePZSbyZ39zD7DLoFUtIYt jVuOToy6dQy681AXlDMqJDrRBXTrczgiy6uxzZL6IylVyQyYBUuLn8ZJVNy0riAkrN3M BeJNEIj2SA94/Nqsct2y3fcoOVwznwK9JVOUHMooqNLgNRHgtjWERpZLrq+qXgL+q8Sz Rv3ORrBQjlLZKmLYwZcvHN8tf6YvXJpB2xBAJH0qC9i9wOnmn7mPgB08i48O7KfoL3dr kZSYZBzFoc84yiGT36iUbs/I57/IcUqwe4W0YbLDzGg6oauLsmVUgxKwAYY/TVGuUbXx W1LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469780; x=1705074580; 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=WY1HVSmMqBvEYUJRh+Ffc8mXYkbCc4MclKwdMWfHMLU=; b=DNPbRqoyo9d7M7pPn/ReTZBXBa3O+ZAB3/dyLCR67xRzMnUvCyCLXsdt0zw5v3ve1W dIvSQ0rycX6ySADNTGvUXcCDUn2TymLuaPN3PxLMD5p/ASC+7L0rJieHoK0KDqWPDDkH HS1ED/LXJO+XvoCHSAi1xFqHMwwZCDQcUuIjpHniapyFTyK+HbHd/FEiU+GDls2ggFwE rMfr5qrV9HLrsX60jl9iAYl48uE0fFLgWNL2jpGqNl0LQApugfX/3ajHufbq/RRb6tWq 6RpJ+MFW19JSjJ085AVc+6iNnFCp/Z7NXvmj0rYZGZqYDe76q9pDlUVQ71Y0rMg6eFHP 6YkA== X-Gm-Message-State: AOJu0YyEJv+wHl+RU9JjXBBjAWR6pM8XYedcokcUN7KDX/4bt9B7g2wc p8FKxpAsTMPOX2j+8LpQG7Frv2LArjvTXskQhxfpp6ZJctg= X-Received: by 2002:a05:6000:1286:b0:337:39d7:3e16 with SMTP id f6-20020a056000128600b0033739d73e16mr810103wrx.76.1704469780660; Fri, 05 Jan 2024 07:49:40 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id q16-20020adfea10000000b003365fcc1846sm1607957wrm.52.2024.01.05.07.49.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , Peter Maydell , Jean-Christophe Dubois Subject: [PULL 64/71] hw/arm: Simplify memory_region_init_rom() calls Date: Fri, 5 Jan 2024 16:42:57 +0100 Message-ID: <20240105154307.21385-65-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, errp; @@ - memory_region_init_rom(mr, owner, arg3, arg4, &errp); if ( - errp + !memory_region_init_rom(mr, owner, arg3, arg4, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-22-philmd@linaro.org> --- hw/arm/fsl-imx25.c | 13 ++++--------- hw/arm/fsl-imx31.c | 13 ++++--------- hw/arm/fsl-imx6.c | 13 ++++--------- 3 files changed, 12 insertions(+), 27 deletions(-) diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index b15435ccaf..9d2fb75a68 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -81,7 +81,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) { FslIMX25State *s = FSL_IMX25(dev); uint8_t i; - Error *err = NULL; if (!qdev_realize(DEVICE(&s->cpu), NULL, errp)) { return; @@ -281,18 +280,14 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) FSL_IMX25_WDT_IRQ)); /* initialize 2 x 16 KB ROM */ - memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0", - FSL_IMX25_ROM0_SIZE, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0", + FSL_IMX25_ROM0_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM0_ADDR, &s->rom[0]); - memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1", - FSL_IMX25_ROM1_SIZE, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1", + FSL_IMX25_ROM1_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM1_ADDR, diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 1d5dcd51e8..c0584e4dfc 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -63,7 +63,6 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) { FslIMX31State *s = FSL_IMX31(dev); uint16_t i; - Error *err = NULL; if (!qdev_realize(DEVICE(&s->cpu), NULL, errp)) { return; @@ -188,20 +187,16 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR); /* On a real system, the first 16k is a `secure boot rom' */ - memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom", - FSL_IMX31_SECURE_ROM_SIZE, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom", + FSL_IMX31_SECURE_ROM_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX31_SECURE_ROM_ADDR, &s->secure_rom); /* There is also a 16k ROM */ - memory_region_init_rom(&s->rom, OBJECT(dev), "imx31.rom", - FSL_IMX31_ROM_SIZE, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom(&s->rom, OBJECT(dev), "imx31.rom", + FSL_IMX31_ROM_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX31_ROM_ADDR, diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 58f37e7c11..b2153022c0 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -109,7 +109,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) MachineState *ms = MACHINE(qdev_get_machine()); FslIMX6State *s = FSL_IMX6(dev); uint16_t i; - Error *err = NULL; unsigned int smp_cpus = ms->smp.cpus; if (smp_cpus > FSL_IMX6_NUM_CPUS) { @@ -423,20 +422,16 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) } /* ROM memory */ - memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom", - FSL_IMX6_ROM_SIZE, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom", + FSL_IMX6_ROM_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX6_ROM_ADDR, &s->rom); /* CAAM memory */ - memory_region_init_rom(&s->caam, OBJECT(dev), "imx6.caam", - FSL_IMX6_CAAM_MEM_SIZE, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom(&s->caam, OBJECT(dev), "imx6.caam", + FSL_IMX6_CAAM_MEM_SIZE, errp)) { return; } memory_region_add_subregion(get_system_memory(), FSL_IMX6_CAAM_MEM_ADDR, From patchwork Fri Jan 5 15:42:58 2024 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: 760204 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107915wru; Fri, 5 Jan 2024 07:54:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIrevc4jwQFrnSNvsRSZFSJY2uhQWNKG4Tho/6Jd9NyTogpt4FBkzJIAZcqsY1vM/IBoXH X-Received: by 2002:a05:6830:c3:b0:6dc:3ff:df52 with SMTP id x3-20020a05683000c300b006dc03ffdf52mr2245260oto.28.1704470061395; Fri, 05 Jan 2024 07:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470061; cv=none; d=google.com; s=arc-20160816; b=ZdDWQQK+7u4UdAbfRAQ8Qd3giRqTl8DIdVKAVZdDIk58BkgzJMWqD6O9b3G2ncu8PM irwimGxNLYK5QuWotX+NYhn16H8hxjS937FQL61n69kzEpfONooNHgILsUcgzLqIdNWg 3U8J0yhTI4tN7xi+NX6HfBxfwg8TMpej4vS0P4uA+9TJTcx2AhzpGk36VYxUsVwBTFdP uYbrt08ZXMsNJcxCYq3VrPMxf+HA170oJY0lihWTxuidwXdyS8lp2wNoXyByHdfwIKFY MlmtNLFpGCjUULL2IzFm+OsUUHw2V65z23AKbKBlzw2P3WPqfh6UvlOQerwm1fhH8IqM tj/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=PoxGR8z2iD4/dV7vlDevdlyqaz6yGMvGSLHUDaB/+Ko=; fh=blOP6cOSNCAbDKwnsy0Dgmm9z1Xj+QQhLO4S+72HReE=; b=tKhHbi1JmVJrtenOaf8/FZaSrGlC8mI1TDdC8m+NdMfzeklUK8dtSyHP/WxQRIih9u ZTtsQku91J1qPPZqqTwCmPqK1UlEy4UkZYq8KPoYNhSttWfYI3oqwfVJyCZ5Anei3CyO fja/SKgA0l6x7c7GC7Gwo052+D1qLSJAMrC5gmN2QkEC19fxOuEpr/B6kbMy5hbCs7fz J9ABgnx3yT1mH1zIGf2fNVbh3Y+vso3gKtV7sMr3yd4XuPYvkcLHKik7m0NfGpq2vxVM FeOsMEKDjQWchtjRGA/8KYnaKDUT7IP1eK7GpD9ci4TV5xFkzdRX2TJWD61QDWPAMvHm 0NTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lS7mHqvQ; 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 pb14-20020a05620a838e00b007811a26404bsi2156926qkn.768.2024.01.05.07.54.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:54:21 -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=lS7mHqvQ; 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 1rLmTP-0002rg-DU; Fri, 05 Jan 2024 10:51:03 -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 1rLmSI-0008MD-Fu for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:56 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmSB-0000xb-Ce for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:53 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40d6b4e2945so18127645e9.0 for ; Fri, 05 Jan 2024 07:49:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469786; x=1705074586; darn=nongnu.org; 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=PoxGR8z2iD4/dV7vlDevdlyqaz6yGMvGSLHUDaB/+Ko=; b=lS7mHqvQydw9G3Y95Kh+xSnAHmZcPK6Yh8lO6Q5C9+RCv/1NWXRQ4A55nbW9oDf4oQ 9aSJuVas4MVrsgWiIyEyzqfq+nyNySZfOtIC5N9GM+HXAHyfV/1Lho4v7IPKzpQkYaqr egKqoEs5pBlK1/60ZWAnVsBN2S0ysVpzIxlnweC/UHHMq7PIPpCNsERY2FDaavfUtJtP 4fTGLJ+fesB/gcydoGNKFrRiX3rH8XYdKuDJUZWh43hwFe66wwqDN7QzUPVMpt3zpFZ2 2kIM3RYtJYkES9osuoVYSZzPSHx2XaQg0UtO6rJ4wRa1uL157YP0fxCdqjJ2TwPoMP1L PcSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469786; x=1705074586; 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=PoxGR8z2iD4/dV7vlDevdlyqaz6yGMvGSLHUDaB/+Ko=; b=DhOhgTlhNaCvlWcyaSdzQ6R5HDbxlgvXKE9y9FDlVjgk0QDQ0ey2Bw1kKnz1C1s/TB PZqTi/U+w87xkMncPIOlHVhuRp5wxmiFHW1btmQQUoWllRHLdvHl+bh0P5Gf2wMBQbIF D/Gm74UTANVHGzxe44MnN8oQRnU/9aCnkLuI67ipoZZU8fP+ohNYG7vpfqmZygczukau Xz6LLUWHiJg1HOXZlx6T37/8+onBDS58+INxolkIHOLc57Ts9IMzJcuE+CyrojPFEzBC aO7EKwFz5xtliv9nYRQeuQbCcCxAQ2x6LWMrPLYZ6CAifpIcnrJsNCb8Rmqsz/ImfZEY TFEQ== X-Gm-Message-State: AOJu0YwmJG/UnpkKyPxCHsPULCvg3EuE/burt+n+95O4P6LdXGjt1LHo I4PmMKIC/ikH4j/h+bw+Xjt/ExG2dNOp0VE6snxOsPcm4vg= X-Received: by 2002:a05:600c:22d6:b0:40d:5d07:55d3 with SMTP id 22-20020a05600c22d600b0040d5d0755d3mr819881wmg.177.1704469785886; Fri, 05 Jan 2024 07:49:45 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id b14-20020adff90e000000b003375c072fbcsm896486wrr.100.2024.01.05.07.49.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gavin Shan , Mark Cave-Ayland , Artyom Tarasenko Subject: [PULL 65/71] hw/sparc: Simplify memory_region_init_ram_nomigrate() calls Date: Fri, 5 Jan 2024 16:42:58 +0100 Message-ID: <20240105154307.21385-66-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 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 Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, errp; @@ - memory_region_init_ram_nomigrate(mr, owner, arg3, arg4, &errp); if ( - errp + !memory_region_init_ram_nomigrate(mr, owner, arg3, arg4, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-23-philmd@linaro.org> --- hw/sparc/sun4m.c | 21 ++++++--------------- hw/sparc64/sun4u.c | 7 ++----- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 64895aebe3..550af01690 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -577,12 +577,9 @@ static void idreg_realize(DeviceState *ds, Error **errp) { IDRegState *s = MACIO_ID_REGISTER(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.idreg", - sizeof(idreg_data), &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.idreg", + sizeof(idreg_data), errp)) { return; } @@ -631,12 +628,9 @@ static void afx_realize(DeviceState *ds, Error **errp) { AFXState *s = TCX_AFX(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.afx", 4, - &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.afx", + 4, errp)) { return; } @@ -715,12 +709,9 @@ static void prom_realize(DeviceState *ds, Error **errp) { PROMState *s = OPENPROM(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4m.prom", - PROM_SIZE_MAX, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4m.prom", + PROM_SIZE_MAX, errp)) { return; } diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index c871170378..24d53bf5fd 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -454,12 +454,9 @@ static void prom_realize(DeviceState *ds, Error **errp) { PROMState *s = OPENPROM(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4u.prom", - PROM_SIZE_MAX, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4u.prom", + PROM_SIZE_MAX, errp)) { return; } From patchwork Fri Jan 5 15:42:59 2024 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: 760199 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107614wru; Fri, 5 Jan 2024 07:53:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjkoHLpC2zniuIIn/wlJcttTMQXF+wLb1L8riW8za80SNSg7tuwt/CU0h+G7A6mpwf34Hz X-Received: by 2002:a54:470c:0:b0:3bb:bd7d:445d with SMTP id k12-20020a54470c000000b003bbbd7d445dmr2035097oik.111.1704470013986; Fri, 05 Jan 2024 07:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470013; cv=none; d=google.com; s=arc-20160816; b=OG46kGzehAoicvya4XE4lDBWCOSyLzryCIn4aE+RMMq72ZCOCH5hchx+0TS3fXMHI9 Dx+w+VRJKS3kJ5QNewZV4haNmv7OTXXkmyfh3JRP79v8zIv6uw1yb3xjKKD9MAm79kTD sl9ad8WRXqh0gQ2Sw5WKL5Ji+xzrzopIGnh31XmsJ1KMjW5cHoWuDQGgWjb3nE63QwX+ qscVmpaeBG/cbhvHE+8si9kIFItWmTcfdxYMLCZn7IpCRbkb0Nnyzlhr0KcmS0ogdTN6 apMD8bDHrSL+D6m1VoYFSjHNrYE+uyDuAcs3ByITVNab/MPCShQ/c7qnx3jrSvk/jZRk sdQQ== 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=Z5/v+dvKjgkiKWiEWELJXJdh6CxKEAYCa0IE+244Hh8=; fh=g6/8fu8e9GIV7auJ5exiaeUZJw/Dl0DeOjMzgfSn96E=; b=aM7lJ9Eoi7lQvPyACyNax01mIkO+YFU3Z00mxXpSs72rk2P0BeWm7sv9u+gZkPzAGO E05iRAbnCAKAgTvsk5r/SSPd4017svYj1VCYceURitVrYosz8Sd3gnbgUqYI2RwF7ddp dRjFk8k2zVWHNX3UqDY7PTLzt1kWSTHFQXJl0q8Jc+MXALsEXqjCRY5SMcAegSRJ+0iE Sg/XhsMuFyvxZkVGR2SfD/KqXgXz749tz230T5o+F7e4nzpP17Od/9Zk3BTE7i7o4x8z UBVPAKHrM9cfqU2II/UgHie9V1a7Rbs/+hWhzBFkMPi47SfdVHWaQU+zgVSPyhlgrOH3 Rc0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QGmMTmsP; 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 q11-20020a05620a024b00b00781bea73c70si1901774qkn.669.2024.01.05.07.53.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53: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=QGmMTmsP; 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 1rLmU6-0004x5-Rn; Fri, 05 Jan 2024 10:51:47 -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 1rLmSL-0008RA-P7 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:59 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmSI-0000zP-7t for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:57 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33677fb38a3so1538914f8f.0 for ; Fri, 05 Jan 2024 07:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469791; x=1705074591; darn=nongnu.org; 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=Z5/v+dvKjgkiKWiEWELJXJdh6CxKEAYCa0IE+244Hh8=; b=QGmMTmsPzG09YP9RTv3wX7hL7BH1ePk48LweT5ro7lTtu1EO15dnbc0Z7nwii5Uxlv gAW8H1cVZTlXlUlS+OxOd+rST3K69Lolv8+WWSp2MLaik+gKY0wkGMOaSnad4wKvOwaY wbSeFAQWo/UyO2VJ0uxalm2g6PT1ouLlhmkAdqCjMfVnxOq8wODyPkFXzSUNMSEWhuzG C9NYGv5GTiIkFuNPID2YoDeML53hhQRqvubhLYm5Es18EQyRCbEUR8bcbSDT014IfI4V HvbV6s43a0bbTa/59PAjyk8xD3Nn0gw0cbe58Nf0eksTU3spwYiD0joNdjXsVmIMmveD rDSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469791; x=1705074591; 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=Z5/v+dvKjgkiKWiEWELJXJdh6CxKEAYCa0IE+244Hh8=; b=Gn9DNmQi0E2P6w6pqRlxC/RV7osT9Uy4mNJwFpUkzf8cKIX/jBPtNy7r9/3CwzqFdM v6Uxeui2mQnos3UHXp/5qA5StQJVGhWHya3ZAbhzOMpe374OB7WAwcGmIjA7RftpIZbj 0tOAt86mNXaxeo1mcVgDnJOh97cydJDsIRJkF7Tfr6XuudOF2xCMrRKuyDMAe+9CAtEg fjN/njGMTNdNphAF7alhlZhCfEqHY9kRfOGbq93LVMW23mBZHF9DHSvHwjP/4WDBpqiK wwd13nD4SMopZPWA95rJq2GF3zWOAEsKtCzEofTRvhgB0XQqlRvn5yUKxdSmSmJkGvuh gegw== X-Gm-Message-State: AOJu0Yynx37I+d8y5BIywQtZIvX1CTJy4inzdNNEppn7mD2lKif/Z2Q1 eHbqv0zsxlO/YQaRSmm7Cnnv5HFZ2KrHWn8otM/7fbkM7HA= X-Received: by 2002:a05:600c:3488:b0:40d:8514:fb5 with SMTP id a8-20020a05600c348800b0040d85140fb5mr1225021wmq.21.1704469791170; Fri, 05 Jan 2024 07:49:51 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id hn3-20020a05600ca38300b0040e398f8cafsm1647488wmb.31.2024.01.05.07.49.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan Subject: [PULL 66/71] hw/misc: Simplify memory_region_init_ram_from_fd() calls Date: Fri, 5 Jan 2024 16:42:59 +0100 Message-ID: <20240105154307.21385-67-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, arg5, arg6, arg7, errp; @@ - memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, &errp); if ( - errp + !memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-24-philmd@linaro.org> --- hw/misc/ivshmem.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 62af75e862..a2fd0bc365 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -476,7 +476,6 @@ static void setup_interrupt(IVShmemState *s, int vector, Error **errp) static void process_msg_shmem(IVShmemState *s, int fd, Error **errp) { - Error *local_err = NULL; struct stat buf; size_t size; @@ -496,10 +495,9 @@ static void process_msg_shmem(IVShmemState *s, int fd, Error **errp) size = buf.st_size; /* mmap the region and map into the BAR2 */ - memory_region_init_ram_from_fd(&s->server_bar2, OBJECT(s), "ivshmem.bar2", - size, RAM_SHARED, fd, 0, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_from_fd(&s->server_bar2, OBJECT(s), + "ivshmem.bar2", size, RAM_SHARED, + fd, 0, errp)) { return; } From patchwork Fri Jan 5 15:43:00 2024 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: 760225 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp111600wru; Fri, 5 Jan 2024 08:02:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3SVqxglTrFYqmoP4lDTiwmz8fjlpMLYAGv5tQV9t6qRLprAR2MyMcEdaK8qEP6lWRKX+H X-Received: by 2002:a05:6214:5090:b0:680:c86d:3f6c with SMTP id kk16-20020a056214509000b00680c86d3f6cmr2118998qvb.36.1704470520256; Fri, 05 Jan 2024 08:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470520; cv=none; d=google.com; s=arc-20160816; b=eZeilQPa7RmzB+aEf4gjhjLvEXuYFECozSsSgrTFvB6jGVku1eayHQv7cMzdY6di+q JU6LVw7CKE4dW6d9UxEAilPjgzZWUtsDXsJOdwQhh2fmsU5Szmg/n0K2P8PE3rzvUNaj iOvHMm8DvJ2e5ciJN12GWWpU3MVnrP3uw7zSLE7FiAaRdD9q8PbepW/a5kzn2+q0SbEp N2VFNljK2GTQdw4oupe17yxNjMtvlhQwqnvW8X3TjAC0ymXiRP31t9w5j072UBCWqrJL zIhIFr8TcEkKECHquIGZCV621hp63Jx/4OXHzeOYK4EdbTbYKU6LYW1xdBnl9LUPi2ul neRA== 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=h8Y9INkkzpXAHIBaDV6X4EdXcLZoAOfyToK+IgBwRCs=; fh=+qf+pcB7BYjjnfnO4Nktpjd3J5C2qdC6t0g0pNpbakY=; b=WM60R0S2YjI6aDwnRusBgh6XabhV7x99I52rMnP/zdW4jKgriurWnMTFQH2TE5Bfkk PXFDzShlwwmKCmcEN3IjYQX0Ub9rY7u0VufGQy7MZJ+ahziO1SiJIYhU9/XeNTOweFwR vFkLkw6afKQm32/u07CMMvYQdt9DTv+MWyvNOetOZ8Iqo3D/LLRsUm0HEgvP0WPmiPvA q64ebERA9w+O2i462ljw9nYsLAT9gU19AG5IvlOoffhbDKh2qs9VoH4YblrQ1I8WDRAM dmSHUg8J4A8cYQ6oYblU6NlIvZEDCwyVapWRqemaKf7jM96Ic2gkzh7UzRtXws6sUggJ WwTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=trG9EbVh; 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 c17-20020a0ca9d1000000b0067fae3119a4si2027875qvb.433.2024.01.05.08.01.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 08:02:00 -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=trG9EbVh; 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 1rLmTW-0003fz-E1; Fri, 05 Jan 2024 10:51:10 -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 1rLmSO-0008WF-Ub for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:03 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmSM-00010K-69 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:00 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40d5f402571so19120245e9.0 for ; Fri, 05 Jan 2024 07:49:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469796; x=1705074596; darn=nongnu.org; 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=h8Y9INkkzpXAHIBaDV6X4EdXcLZoAOfyToK+IgBwRCs=; b=trG9EbVhTGYocEygqSoykHHDkh1JoR0PUhzxazvHz7oZ+PleHicBzuXNFOjxTqEdDK 8By/C6OFTFxt2LuM7D35vPSxPo5QBx5ucQfRiq4Z5tiBTgUDo/1P2XckLZAGMtk4LQ/l 2Keu9fXhHLFt+ix/xtuFH/axA4ea7Ne4l9ybsrDQU/mbkD8y3vIuS+eFtm+7MzX6zad1 vR9ZifAi9/DdS8gdg56M0j/w/alidI2k/fsSif4vcdnbGqB1ZlhHqUMF1h2LwRMzawVi UOYQs7Dogxrk8Lq4RoqKbjkyP4HscJ4Np4DT561c6jjxMWMM9I0ZFYUGyzODoK/yfwKE gitQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469796; x=1705074596; 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=h8Y9INkkzpXAHIBaDV6X4EdXcLZoAOfyToK+IgBwRCs=; b=ObkRZNGhexxhkhmbOZgpnuyrdqjYw64+8DMui/RN6M8MVIK+/GPr7jursLGBn2mqiY lnzeiHov8FC1CMoplFmGfU8oGjJYbnzfXgPMRZu9bRzMFMq44m/tfEK2NoqafgUMQi2T EaSkgmQs5EyelbsZtJOxh4Gor277hcbUvOeCnbos/vydDx9iDqctc6TxjVUGRhJ8NArB 8Yt0iFTFXR+jKjSSnp5djuawXkR+4qUCvoRQMuVPzfPn6CaxrCx7DF/DQenLz66TnDlI EhLdZkQot+ECh7tmF+P/cXB57SfMLUj2V9uOyhWJn7FqDGK/Ll05P0FgKZGobE7zBBd3 7SWA== X-Gm-Message-State: AOJu0YyiJShQLi0zkWFzwrNNEQ+oUbWNNLZ37KQCXSBeDoZPB3EJsWC4 6qlmQlbhdFugdbcnW0XL0xLv4FUtHkOI6TlJ78RsAvPJ+DI= X-Received: by 2002:a05:600c:a02:b0:40c:45e:f89a with SMTP id z2-20020a05600c0a0200b0040c045ef89amr1280111wmp.50.1704469796358; Fri, 05 Jan 2024 07:49:56 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id g11-20020a05600c310b00b0040d94b65342sm1927739wmo.48.2024.01.05.07.49.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , Joel Stanley , Peter Maydell Subject: [PULL 67/71] hw/nvram: Simplify memory_region_init_rom_device() calls Date: Fri, 5 Jan 2024 16:43:00 +0100 Message-ID: <20240105154307.21385-68-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, arg5, arg6, errp; @@ - memory_region_init_rom_device(mr, owner, arg3, arg4, arg5, arg6, &errp); if ( - errp + !memory_region_init_rom_device(mr, owner, arg3, arg4, arg5, arg6, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-25-philmd@linaro.org> --- hw/nvram/nrf51_nvm.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hw/nvram/nrf51_nvm.c b/hw/nvram/nrf51_nvm.c index ed8b836074..73564f7e6e 100644 --- a/hw/nvram/nrf51_nvm.c +++ b/hw/nvram/nrf51_nvm.c @@ -336,12 +336,9 @@ static void nrf51_nvm_init(Object *obj) static void nrf51_nvm_realize(DeviceState *dev, Error **errp) { NRF51NVMState *s = NRF51_NVM(dev); - Error *err = NULL; - memory_region_init_rom_device(&s->flash, OBJECT(dev), &flash_ops, s, - "nrf51_soc.flash", s->flash_size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom_device(&s->flash, OBJECT(dev), &flash_ops, s, + "nrf51_soc.flash", s->flash_size, errp)) { return; } From patchwork Fri Jan 5 15:43:01 2024 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: 760203 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107776wru; Fri, 5 Jan 2024 07:53:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7ybc6HW7PlDVJByD0KIPi3k5Ezj3pddxznNuA2q7HzsH2g7mRh8TGIB3zyacKPHdAXmib X-Received: by 2002:a0d:d2c4:0:b0:5eb:6c37:6b46 with SMTP id u187-20020a0dd2c4000000b005eb6c376b46mr2028055ywd.22.1704470036600; Fri, 05 Jan 2024 07:53:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470036; cv=none; d=google.com; s=arc-20160816; b=ms2nr2IRzVuWZKrlo2Nh9LcTPrnqJrS8KYvDBO310zqO3tM+E26J/wNp/IlhJWBMLK j9kQX9B0cbfZ5SwBfeVEoZ9E6uUGJ8eYNMiGMzC973GF0UdN4z/VB/3zQZ1mX71tQEEc AkQf7OMnYqPe/1THgPQt6LdZCsY1opq3XX1B9z4zpAuYibEGaKT5Pcr4XvOnlS7kuTs1 aQUs+NqE+PYDLYYww0hLr3tWXHb67jT2iJsJH1xDme37aukSK36K75Kiz7ULWA46Bh9r NfdWNIb8QjTb+O/C1m94pG4ioNh2vrvHY85BbJ3YTNYjyarJXs1R0TnG1YK7o0yqQAKB 64dQ== 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=SDwxzH3vS9V/d1nX5dyRUP+IK7/Bx5gX/AEs8zKaqSE=; fh=53R36PWsaLGjmBMV7qE1Lee5gWecQsJJ7THKvSL8AFs=; b=ucrwdssbbKeMBEtYW/WoHNhIdXZE0ADZ7FuPmccz8tkDxPvCYyZ+QrTEt/v7XUSXJ9 XHCjLJUa6XDmI60vfQeaa6HipOudRn9juY9EGv5YfljQZVCqFTaDPwfcgUenryh0dyUS 0S7JN1ovRY7bfJoEKM3AV3q6Oek6ZMtNX6Fd1UlcljSVDAMap8zNxRaOw9KpT5WB5048 ETEpzA+E/8CEqYmToinCglm5pHRYcLufcve35+QO1Dw6cBrRZqL67W7EUK+N669hfLaY gBR91wkfEQRdgfvCcabBCCBxaZ+9KPQIP+H4ghjLaRRFldRgj1ZtcC6rQvwzEKRgW5Fv 4Qig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=serQmlLI; 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 c7-20020a0ce147000000b0067f29f2374fsi1979023qvl.402.2024.01.05.07.53.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:53:56 -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=serQmlLI; 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 1rLmTZ-0003wr-QM; Fri, 05 Jan 2024 10:51:13 -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 1rLmSU-0000A7-JZ for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:06 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmSR-00011a-MZ for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:06 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40e3b43173eso2095825e9.1 for ; Fri, 05 Jan 2024 07:50:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469801; x=1705074601; darn=nongnu.org; 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=SDwxzH3vS9V/d1nX5dyRUP+IK7/Bx5gX/AEs8zKaqSE=; b=serQmlLIe01mZ/Q4/bElvfh9EQf7ZBvIKcZy4qmSldLsvUS859MG0lwpZ6amaLkSp3 uDJIkL+28oYOdcbODmN9PVgUBfF1NFIJ0Pr8yr4HOODW3jDzAI5hbQx/ZhGn1LPXtHDN Y7X0uuVB0zmqSs1qOoMWZOff5Y2sQqgKu3IQTwYs6HSVIAmc+Pfr2wrA/KaI4jcqOqO3 t8TbqnqowaqijPSJDiZOrg7B9XHEENzZT+JjBvWjrnpCabOBrAkiO+DVEQhoXS7q22/O 6PdULmvbzC5lG13RZEK7cYrqfnAlnzG/iQ2nBEXaCaJ84PpcomS+B7Bl6jR6UYLXMiar Vjig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469801; x=1705074601; 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=SDwxzH3vS9V/d1nX5dyRUP+IK7/Bx5gX/AEs8zKaqSE=; b=DUOOgbMMe3OgBnMi+cyrBOMGy1UDQk3UFDzweBXT4Piba4cr6mkJaZCKnEVGyBm6Ib 0Q9Eh02sMV/z5dzJRaOXsagX2dEjFTJ3k8mA808FYV8gm8amLgPhaMMqD1dZLz51NY+e LWDPeBvqCx0gR5zE6ISNKeg/CVx7FlzZkvoJATs3eNBQaYjkH0kJJmtoEatamr6kSK2Z ayux8bZySfkkI+u4GsyEuRTdnYauW5GESTHUkihdAiIskBgWiUyhoqfMdBkIjdT1rX3v 1mVFRCaRHjg96ePNDM/ZU33PKg3FuYBTCoJr4Nk/dK/1EQiM/r9vmNoZqRkseaP81JKe nmMg== X-Gm-Message-State: AOJu0Yyk2kyammQrOLJwOdMo2JIOA4Anx+ah1nVIOwFam68fYDc6cpex 2uPhkubWzjYgUTgiq384lAHxlhhFQHDZJoELL9nnf/7S/ys= X-Received: by 2002:a7b:cd96:0:b0:40d:5821:5148 with SMTP id y22-20020a7bcd96000000b0040d58215148mr934968wmj.67.1704469801572; Fri, 05 Jan 2024 07:50:01 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id b1-20020a5d4d81000000b00337405c06a6sm1621048wru.48.2024.01.05.07.50.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:50:01 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Manos Pitsidianakis , Gavin Shan , =?utf-8?q?Herv=C3=A9_Poussineau?= Subject: [PULL 68/71] hw/pci-host/raven: Propagate error in raven_realize() Date: Fri, 5 Jan 2024 16:43:01 +0100 Message-ID: <20240105154307.21385-69-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 When an Error** reference is available, it is better to propagate local errors, rather then using generic ones, which might terminate the whole QEMU process. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-26-philmd@linaro.org> --- hw/pci-host/raven.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c index f71d4872c8..c7a0a2878a 100644 --- a/hw/pci-host/raven.c +++ b/hw/pci-host/raven.c @@ -345,8 +345,10 @@ static void raven_realize(PCIDevice *d, Error **errp) d->config[PCI_LATENCY_TIMER] = 0x10; d->config[PCI_CAPABILITY_LIST] = 0x00; - memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZE, - &error_fatal); + if (!memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", + BIOS_SIZE, errp)) { + return; + } memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE), &s->bios); if (s->bios_name) { From patchwork Fri Jan 5 15:43:02 2024 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: 760207 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp108027wru; Fri, 5 Jan 2024 07:54:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IESEvBYeMaMkqQfJYbSYEkXccjal/1VIuW1p2Omn9x90cpk8L39Gd7Of7ROLjzo5S3Dezse X-Received: by 2002:a05:622a:118b:b0:428:11c5:723b with SMTP id m11-20020a05622a118b00b0042811c5723bmr1904263qtk.96.1704470077283; Fri, 05 Jan 2024 07:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470077; cv=none; d=google.com; s=arc-20160816; b=zEOMoVDUbakuEjfeRh9sVNB+nwaMcLO6W4NhvZBSOPfRa7rjZEyufMSkvKeVxzvFzK x3VryAC0vYSefTWgojsFiRbo5eqkxaKVE+tlz7i8oiUT2KDLuZN83aEqVW8VZIoPnXmQ 5+ZSwCA0wezRTpLwoOrurEeRFWWND1Cb4254DRL7ogkf1PgxHZGaz146GgLeI1xOSiCX fkmlasT8N4nLuh3jSm7DOuagEPKERoPYaCliWPdCra+p3foKlVeA0mdBG4RzIE5wxoQo tf3/wUumBWwoLdmM8QdfirfSDJAaWkiAW4YAWfxBuyRzCfl74tXLt/KZ2BL6UpyLyHEU RtUA== 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=Nno3VTCeo04e35HOY3p6uYOV1tAtecR5ZW2yhenY0Bs=; fh=Wm46THIaMx/Gr7DBK5P4sUJlZBqXtbhLLlo6thGXO6E=; b=wZPYp/E9mAp2TzXIozA7uoRa/1P5FRF8KNB+rAqhPtP0F2fF98PT9UManWdqsdFshQ wpzZ9lJg9U77hUILnDD6OgMHlGTXK+473SPfjpbtGUfbBXfolvOBxFjh4Cgj5HSu69vI aLZ2FVQV+IYTEyGq9mDlaPSB9b9Y+AVpV1abunGvbWWjBLOfNVSVCJ4X2WNlWIEm6S2g MOc5qHSDDBzVDVBvN/xI1GQ2W8758Mr5KlCXxQDgE/Jvu+RTIGuohn5XHVbNF4QjwGo2 7PeG0yS5TAjuNOlk06vdOGm4s0rLtmxViHHeMkCeoKYU4YVBrJhqHUt5XqBWV1r1oPSp F+KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WincsaJJ; 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-20020ac858cd000000b004297dcabbfbsi245029qta.345.2024.01.05.07.54.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:54: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=WincsaJJ; 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 1rLmTT-0003NK-Qk; Fri, 05 Jan 2024 10:51:07 -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 1rLmSZ-0000of-EJ for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:13 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmSW-0001ES-F3 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:10 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-336897b6bd6so1525530f8f.2 for ; Fri, 05 Jan 2024 07:50:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469806; x=1705074606; darn=nongnu.org; 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=Nno3VTCeo04e35HOY3p6uYOV1tAtecR5ZW2yhenY0Bs=; b=WincsaJJFH6/ydoWKzmDqEwadD24rT25SUPVLUTA2MOp2iyLtBxtrbgYvSnA+4cWEf C0LfAd4J2UhnX2wfrrTp3z7weXamxReN5VujcADpZJ5LYhwVJV1LPWRH77nwU1WtMOkf 7FtdzEcLWsNhbkBG6FNJ0ogpHrSl7LxL8mLhbqy29U0UZDgjvsqAqQ4N35PoqlODXJ1d CIbgnFXKKvnAA4FgZNwrJkd2ahJPqsZVWt8VCSUXS0ryZ6KnXhz8/4yANRdiw7SiUTNZ N2sZQni3D46JyI4hDbjUMpBpR4YoqyN34KLbp3D3kTbw5gc8Dd3xaygryrcbPS1ZNMQv 0mlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469806; x=1705074606; 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=Nno3VTCeo04e35HOY3p6uYOV1tAtecR5ZW2yhenY0Bs=; b=cuBSLQwnitoxvuw36mG7IYKD6w1pcNkOha2r7E54gy9c8iIMpMXeQJlzbiGhlcNDrX Ttx2LHyk1+yWjTf833fwQ+BZcgqOY5hhvdU2uH8+Fk+WbOR3qKkITZ4gUBryKR+ocML4 ObIJSIXwrdxeDO/UCBgJcq3kKC71fC+WiCYrQgT0HIozto/WmauAmGbZB9I1rfaMDtaW 5kMaSLomt+W+FUEurdq7eLvYJbdPoT3I6N0F334cRn1a+3Vq8h+BKRWMwAEtpq9oyle2 kmgBlqYjPT9w/E5TBZG3IxOwMKoviJad9HVohpImQBuqSznUIbmjh7ZMQ73ucTpaNjPQ BoLg== X-Gm-Message-State: AOJu0Ywd+BKF80kGaseEX9fz1+v5mf7s+mnaOOw4f8gtFBVUiayW1YoA wraZrLigdycM7E7ITvM3XtDnuWjaSVQw9Z1Wkx+tk33YLp8= X-Received: by 2002:a5d:62d0:0:b0:337:5cf8:b12a with SMTP id o16-20020a5d62d0000000b003375cf8b12amr235231wrv.135.1704469806693; Fri, 05 Jan 2024 07:50:06 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id q9-20020a05600000c900b003367eae8e18sm1623623wrx.57.2024.01.05.07.50.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:50:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Thomas Huth , Mark Cave-Ayland , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 69/71] hw/m68k/mcf5206: Embed m5206_timer_state in m5206_mbar_state Date: Fri, 5 Jan 2024 16:43:02 +0100 Message-ID: <20240105154307.21385-70-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Thomas Huth There's no need to explicitely allocate the memory here, we can simply embed it into the m5206_mbar_state instead. Signed-off-by: Thomas Huth Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20231221122939.11001-1-huth@tuxfamily.org> --- hw/m68k/mcf5206.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/hw/m68k/mcf5206.c b/hw/m68k/mcf5206.c index a46a23538d..183fd3cc08 100644 --- a/hw/m68k/mcf5206.c +++ b/hw/m68k/mcf5206.c @@ -148,15 +148,11 @@ static void m5206_timer_write(m5206_timer_state *s, uint32_t addr, uint32_t val) m5206_timer_update(s); } -static m5206_timer_state *m5206_timer_init(qemu_irq irq) +static void m5206_timer_init(m5206_timer_state *s, qemu_irq irq) { - m5206_timer_state *s; - - s = g_new0(m5206_timer_state, 1); s->timer = ptimer_init(m5206_timer_trigger, s, PTIMER_POLICY_LEGACY); s->irq = irq; m5206_timer_reset(s); - return s; } /* System Integration Module. */ @@ -167,7 +163,7 @@ typedef struct { M68kCPU *cpu; MemoryRegion iomem; qemu_irq *pic; - m5206_timer_state *timer[2]; + m5206_timer_state timer[2]; DeviceState *uart[2]; uint8_t scr; uint8_t icr[14]; @@ -293,9 +289,9 @@ static uint64_t m5206_mbar_read(m5206_mbar_state *s, uint16_t offset, unsigned size) { if (offset >= 0x100 && offset < 0x120) { - return m5206_timer_read(s->timer[0], offset - 0x100); + return m5206_timer_read(&s->timer[0], offset - 0x100); } else if (offset >= 0x120 && offset < 0x140) { - return m5206_timer_read(s->timer[1], offset - 0x120); + return m5206_timer_read(&s->timer[1], offset - 0x120); } else if (offset >= 0x140 && offset < 0x160) { return mcf_uart_read(s->uart[0], offset - 0x140, size); } else if (offset >= 0x180 && offset < 0x1a0) { @@ -333,10 +329,10 @@ static void m5206_mbar_write(m5206_mbar_state *s, uint16_t offset, uint64_t value, unsigned size) { if (offset >= 0x100 && offset < 0x120) { - m5206_timer_write(s->timer[0], offset - 0x100, value); + m5206_timer_write(&s->timer[0], offset - 0x100, value); return; } else if (offset >= 0x120 && offset < 0x140) { - m5206_timer_write(s->timer[1], offset - 0x120, value); + m5206_timer_write(&s->timer[1], offset - 0x120, value); return; } else if (offset >= 0x140 && offset < 0x160) { mcf_uart_write(s->uart[0], offset - 0x140, value, size); @@ -598,8 +594,8 @@ static void mcf5206_mbar_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); s->pic = qemu_allocate_irqs(m5206_mbar_set_irq, s, 14); - s->timer[0] = m5206_timer_init(s->pic[9]); - s->timer[1] = m5206_timer_init(s->pic[10]); + m5206_timer_init(&s->timer[0], s->pic[9]); + m5206_timer_init(&s->timer[1], s->pic[10]); s->uart[0] = mcf_uart_create(s->pic[12], serial_hd(0)); s->uart[1] = mcf_uart_create(s->pic[13], serial_hd(1)); } From patchwork Fri Jan 5 15:43:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 760210 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp108549wru; Fri, 5 Jan 2024 07:55:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXDTr/IwW+YvS1oAJIY6EDH+MnGLNl8NJ0GjpUlmIe1U5v0eLSiohk2AKyAXs3hVe3d8Av X-Received: by 2002:a05:6808:2011:b0:3bc:3d2f:20b4 with SMTP id q17-20020a056808201100b003bc3d2f20b4mr75505oiw.20.1704470147984; Fri, 05 Jan 2024 07:55:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470147; cv=none; d=google.com; s=arc-20160816; b=1DjEUfBpVCx6ahEsuryixWulsr4/UR9Wwx8Qd7b6WmHegGD22w31D6reOq3Ku6/Qor DhSN8r2wZGRoQMApU6ctJ8QqzfblA1zmGpM6jhl9Qwk2WVQa/RuceMpBKw9063PMfe23 GZyOUupaUzNY+v1PkWF1Z7jK7GVNRunlKN7Qn5+eFsAbx/S1etzmV6wxAKfyrkSU5tjF Vy9ZzGSzTHbMCpKSxvAOfZCej5yy3nnyBAJxqknjV6DZ2P6qQ2K0Sur+tyXN+Jg1Johl uIMcQagAAVirZnWsuXVbZ+xmGhl5L/YzgnByt/V3uiidjO7gFHMfsjMnNvqYbLzEl/Xx z/iA== 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=sJhN/WyzxWMOOPIeTap61yRQUoY0YL+ZGCT3kZkMZNQ=; fh=xTMPh2SmnK7LCN7tWD8/ixwXLwgQIG/YAKddxD8STHM=; b=eq9QcKaxefWzZmLk0cVcFDSvmsiKIqDrMf5hDH5TaRSg3gFwmE7g22f8dCXL7pLNde 5kjx3RnvH0lm+iSww4GFUIWPrUUxZ7i1CsUhGpjH1Ysh2rmjMwqvo04BkhsO2TsrygxU Tun7h0muFdHbVhP4/Re5U85U8zu9fIjDTo1k4gJbbAqzloOIgqU4x6sV/mw/Yrcu4IjH HQKjF4usw3QnKpQIk7KATemca4zjZ6RYGCdz709kUhdvJiEPsRW+Hei+5cecsW7MxxJp X4lTib6IBvL9GtHVRY3qIyaDdq1rVL16d6DZ69Jh9aRQQdoXd4FmzwjUlKB/L2YJYePL OvGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kbhIsb5G; 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 f18-20020a0caa92000000b0067f2120275dsi1979051qvb.542.2024.01.05.07.55.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:55: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=kbhIsb5G; 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 1rLmU6-0004vY-L0; Fri, 05 Jan 2024 10:51:46 -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 1rLmSm-0001n3-NF for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:33 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmSk-0001HA-L3 for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:24 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3374eb61cbcso1485578f8f.0 for ; Fri, 05 Jan 2024 07:50:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469812; x=1705074612; darn=nongnu.org; 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=sJhN/WyzxWMOOPIeTap61yRQUoY0YL+ZGCT3kZkMZNQ=; b=kbhIsb5G5wAWcU8WA6XlQi/6lKGxmbGxrqPEcemqnUAJHAWx5hQHKlqoOe50A3ShTl 1VjKZw6HJZXRVq0Qkdp3/7TWZnZqz/0Zm6Hvitg5mfr38q44rrsFhW4TCZ2kdOVEZF4w RiGv8yqiwQJ0qh9gznbkrTMAXZuJ0/qlbqeG7B/SxZKotvHVMF19VFSsRvVTp+rYcejd k17URYeJuZmVmQklH/D1WUAfYQu2xiYwuf7NAfsNDt0yHchKrtVurmB1PKsfNg0CYRV9 zxWKlhmZVkFLu4szNRvLhGnHKIQL8emVwUpOXYMi0QeF9SBpw2psC7u0feUG1OcLX6jm hKHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469812; x=1705074612; 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=sJhN/WyzxWMOOPIeTap61yRQUoY0YL+ZGCT3kZkMZNQ=; b=byKGFfuaUTi4bmbo3eacBYl0VcEabCYJY8r0suLDJhtAKWAHrWzHQDM1BTDHRcRPpZ QlRGY7Ryaq3np7RYIqWPZLvI73lBK4uSZZ015OHw4e6+2f4/lfJU7R51tC1Ab2eheI0Y Vl1X1R0adJ4WWDQMIigsk0oFIdB9G9Cr5bRtXcp9ZpECKHNdx2tPHnetbK57rXuJeaIY o+D5jPZc9hVlZRvDDZVAmtt5zHbu5WjBsUv4guRVPF5OYvw092Qs/AFO9/yhu7tWwY1h 7CgEruM7qt3eeqU6tzsKKnvBJUjme2eGlyMcRnLTY5d4KClVg5wbLcJdLXuffB34Oonm Y4uA== X-Gm-Message-State: AOJu0Yzv08YkC3tX/BsfZ0x5+Kk2FuPzpbtFkhnww/SePgAZObl+6+e9 AhdarBEfHjQJ+GplK5Qso0PDlbAMnUvVV0v8jvinCQplXYk= X-Received: by 2002:a5d:6d50:0:b0:336:808d:95e5 with SMTP id k16-20020a5d6d50000000b00336808d95e5mr1497119wri.67.1704469812164; Fri, 05 Jan 2024 07:50:12 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id a22-20020a5d4576000000b0033671314440sm1629463wrc.3.2024.01.05.07.50.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:50:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, Pavel Pisa , Grant Ramsay , Vikram Garhwal , Jason Wang Subject: [PULL 70/71] hw/net/can/sja1000: fix bug for single acceptance filter and standard frame Date: Fri, 5 Jan 2024 16:43:03 +0100 Message-ID: <20240105154307.21385-71-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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, T_SCC_BODY_TEXT_LINE=-0.01 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 From: Pavel Pisa A CAN sja1000 standard frame filter mask has been computed and applied incorrectly for standard frames when single Acceptance Filter Mode (MOD_AFM = 1) has been selected. The problem has not been found by Linux kernel testing because it uses dual filter mode (MOD_AFM = 0) and leaves falters fully open. The problem has been noticed by Grant Ramsay when testing with Zephyr RTOS which uses single filter mode. Signed-off-by: Pavel Pisa Reported-by: Grant Ramsay Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2028 Fixes: 733210e754 ("hw/net/can: SJA1000 chip register level emulation") Message-ID: <20240103231426.5685-1-pisa@fel.cvut.cz> --- hw/net/can/can_sja1000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c index 1165d59824..6694d7bfd8 100644 --- a/hw/net/can/can_sja1000.c +++ b/hw/net/can/can_sja1000.c @@ -108,7 +108,7 @@ void can_sja_single_filter(struct qemu_can_filter *filter, } filter->can_mask = (uint32_t)amr[0] << 3; - filter->can_mask |= (uint32_t)amr[1] << 5; + filter->can_mask |= (uint32_t)amr[1] >> 5; filter->can_mask = ~filter->can_mask & QEMU_CAN_SFF_MASK; if (!(amr[1] & 0x10)) { filter->can_mask |= QEMU_CAN_RTR_FLAG; From patchwork Fri Jan 5 15:43:04 2024 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: 760217 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp109264wru; Fri, 5 Jan 2024 07:57:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGY5bUBMcbW5+dH6pvuqDvFmQMNIO3j1JJVwZh67XbtQOL0dKWSAAupyyqL+6x7JSOS+3n9 X-Received: by 2002:a05:6830:22ec:b0:6dc:5a5a:db3b with SMTP id t12-20020a05683022ec00b006dc5a5adb3bmr2521423otc.55.1704470261162; Fri, 05 Jan 2024 07:57:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470261; cv=none; d=google.com; s=arc-20160816; b=nozyqpOe3Duc5Pr54MFXqrzN6ogqqFRU9t4s8wtPCV0FJywXfTcW6W19qnXvpZL6I7 fH0+/vSal15PrSV75+DTPoLYSaNVH6xyIrl7L6n7prWa0E6reJH7JSIWJukvghfgE3uH lG7BFEUc4kbEpG5TcO+uwkXkeVAnXHYl17wVm7oTFgcUt5g6E59AjFHMZXjdKR/DhaFs iRhNJOviRHDeG4p1mBf7+d0pymRWmKeVvw981Iy/FmwFONQQYj2EtKgZ57XRTmbpbTtj qIBDLcfhzz2kzYkmB8NFekIgzz4VK/u1rjJMhAIHSxWkjaYUUFJDtNQw5LZCM/xltL4X nSoA== 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=7GKplYO/5yXOUvt6X4002htySDt5oqr2bCk1Sg6HTjA=; fh=jhKszhkd9bz0XYow3T6wUE56SStJcKloJg/B7KMIbqI=; b=X2ne0XH/BRwF36MZ34UfshtrH0SqhSg/mQfoUianS15JG9PE2ziK5KnobOj4E4rX+l nvyZfbJoX+1Wq4rlSDriaDjgbDSCbqKDSW5SZVZXagvM9kaZXeJ6gf567vmc/5w+0Sh2 nulrhWr9Pl6onNmQQjI+HUbC5albCOzYpSfepUtgW6Iw1C8d/IHzPN3RiJ/ATLwPDPnF GKIFGlhq539spGkvb9lpcVO6iRx70LnPte/aI7ipcR7YFGRgr01ruKA9bwilxRC96SRw t3+a000QphJ8CyqziyQD9LmTCT/1FEHJK36SrIpuMsy+3ucWpB+aTG8vHA8IFkaT7Hwa elUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dO5G6zc+; 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 u14-20020a05622a14ce00b004282639384csi2041590qtx.53.2024.01.05.07.57.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:57:41 -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=dO5G6zc+; 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 1rLmTX-0003jg-Jl; Fri, 05 Jan 2024 10:51:11 -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 1rLmSl-0001mu-8i for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:31 -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 1rLmSi-0001I7-Db for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:50:22 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40d858c56cbso19623095e9.2 for ; Fri, 05 Jan 2024 07:50:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469818; x=1705074618; darn=nongnu.org; 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=7GKplYO/5yXOUvt6X4002htySDt5oqr2bCk1Sg6HTjA=; b=dO5G6zc+IJBx5gVHi6xy/48X3lWQopv8xi+eAd78hQdyPLLRWNO5prpvnWCUjPImjA hfgcgtmqGuSqxTwDFqsRGq/jnmDFmwZDOQplgeKz/a6SrCb5ItgN/JCjeDMd8P8U6feG 4TVls0yAnhvpBwEkNP4bcT2Kx+Gb5mz58rli0gJE66gyHlpSp+ksQahDI267jZuHPUZd v8CbUnqcRIfa7KRS3DeU8FDsXxtwkx/p0SwDzEPusr/QKLQulZdOwrgP5HztC3OICm1H kTnPlMTrb5VEko3e4eUm9SS/nBXzQTykq5ezDqeyfI2cHSml1C6Qub7TsdvXg86CWIcP 2n5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469818; x=1705074618; 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=7GKplYO/5yXOUvt6X4002htySDt5oqr2bCk1Sg6HTjA=; b=T6Wr6ugOTSWwnMwnRYFnBzmC6XGP2kpzh5jJYTwAl2bOTkt6VmxAcr3DMNmq1UenSR qIxJGzSOXIkZ6Nc7XYTPnQIU1tz7kBR9XwT1rVKoY0/KFsSzLifg8M28BFauToJBhywA JlcoGF5Ghut4n0wXYkK8AXzsqX/u/g/xpyELlMo0kHYN+weK9nxw7gxdA10Xx/r31y2p vPWk1zDPwhd91cGqAx0CZcLPZfaoX29IAGoaWz3gsYYI4MzuOeXPX6xVUNLbkvMjC2Pn raemRMXNoD0LYVrcIwttdx6cAxcS/v0E4TppQILCqIomu9Ncw6eo7BkbHOTyoh1wJnmG As6Q== X-Gm-Message-State: AOJu0YyZ+ZV4GMxtZ7+MCZ9uDsyPDTWlsqO7X6LTx3JgV969GzNQCA64 H3o363gyC0SYCOVl4QOYg8Nn2zmLDDDo048uOj7eGx+iC7M= X-Received: by 2002:a7b:c8cd:0:b0:40d:6c48:a1b4 with SMTP id f13-20020a7bc8cd000000b0040d6c48a1b4mr1359736wml.29.1704469817815; Fri, 05 Jan 2024 07:50:17 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id w5-20020a05600c474500b0040e34835a58sm1933611wmo.22.2024.01.05.07.50.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:50:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Cl=C3=A9ment_Chigot?= , Frederic Konrad , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Fabien Chouteau , Mark Cave-Ayland , Artyom Tarasenko Subject: [PULL 71/71] target/sparc: Simplify qemu_irq_ack Date: Fri, 5 Jan 2024 16:43:04 +0100 Message-ID: <20240105154307.21385-72-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Clément Chigot This is a simple cleanup, since env is passed to qemu_irq_ack it can be accessed from inside qemu_irq_ack. Just drop this parameter. Co-developed-by: Frederic Konrad Signed-off-by: Clément Chigot Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240105102421.163554-7-chigot@adacore.com> --- target/sparc/cpu.h | 2 +- hw/sparc/leon3.c | 8 ++++---- target/sparc/int32_helper.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 6999a10a40..12a11ecb26 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -549,7 +549,7 @@ struct CPUArchState { sparc_def_t def; void *irq_manager; - void (*qemu_irq_ack)(CPUSPARCState *env, void *irq_manager, int intno); + void (*qemu_irq_ack)(CPUSPARCState *env, int intno); /* Leon3 cache control */ uint32_t cache_control; diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 1e39d2e2d0..2dfb742566 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -164,9 +164,9 @@ static void leon3_cache_control_int(CPUSPARCState *env) } } -static void leon3_irq_ack(void *irq_manager, int intno) +static void leon3_irq_ack(CPUSPARCState *env, int intno) { - grlib_irqmp_ack((DeviceState *)irq_manager, intno); + grlib_irqmp_ack(env->irq_manager, intno); } /* @@ -208,9 +208,9 @@ static void leon3_set_pil_in(void *opaque, int n, int level) } } -static void leon3_irq_manager(CPUSPARCState *env, void *irq_manager, int intno) +static void leon3_irq_manager(CPUSPARCState *env, int intno) { - leon3_irq_ack(irq_manager, intno); + leon3_irq_ack(env, intno); leon3_cache_control_int(env); } diff --git a/target/sparc/int32_helper.c b/target/sparc/int32_helper.c index 1563613582..8f4e08ed09 100644 --- a/target/sparc/int32_helper.c +++ b/target/sparc/int32_helper.c @@ -160,7 +160,7 @@ void sparc_cpu_do_interrupt(CPUState *cs) #if !defined(CONFIG_USER_ONLY) /* IRQ acknowledgment */ if ((intno & ~15) == TT_EXTINT && env->qemu_irq_ack != NULL) { - env->qemu_irq_ack(env, env->irq_manager, intno); + env->qemu_irq_ack(env, intno); } #endif }