From patchwork Mon Jan 9 12:08:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640637 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2111171pvb; Mon, 9 Jan 2023 04:44:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXtupuTacVpWnUpgEV0aw1/b52i6Cwx74y507r4qZ+mJXDqwNbUfkQgAAvbLNqxmTgE2BUBo X-Received: by 2002:a05:6214:588e:b0:532:2642:1f79 with SMTP id md14-20020a056214588e00b0053226421f79mr9420779qvb.44.1673268247954; Mon, 09 Jan 2023 04:44:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268247; cv=none; d=google.com; s=arc-20160816; b=G3J1Uj6IwWUtcE2IYP4+5j43SQQrUHFF8I4bWRYC6PQ6b6okxB/A2e8KcLwgsI+t+r rW93+cua34REsTugr5idSkGjHDqmwqkxsGj3c/Sh1tgjr9nv++ZxlbemQQ6juYNQI/58 jh4YqXZz1CWeQdNZdw8b8HQZIo3QP+6RQ/n+giBpPNJ88Ej7aFA8hq6jbWhpFzpr8sLV UVl8dwO4q1h/+qf9il4r0aZ2clYAAkrwFuvwuJdBXddMMEqx98PgquVsNCz/4Q1covC9 TBV6O9am7TavyAJcdYAvuaWiVvLtYcwmVf+g6LogXm9gIgTuYavC7m9hjXrEOOHVtBFn 3qVA== 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=LUbM2ZYO9/VNz+sUlf1XOfM6SSTREiXg498MIdZvH+I=; b=kRY3pSlGkLohKKiB+m3JcYs4LqCn7jPKJz9fDZbOcxitDNGiS6SxDiOqb38wZDrlDW 1xibghaHR/8xR0tWsaZTUx3Mvl100/hNaGKTfbQWSQC4GSq1Bcs0YHe1CLtQ0ReHNhqt e9Gm28J20pxYFgOD26fr3MlSL/YT9LKS3jWg9n+t1iQW4WQGTvoyTLjihqt82v6cjcYc MSTVK9AHYIQg5XmVR6EoDtlO74biFBEnJGMDq6unyj+91RfxnX4ZEME8mc1Dz7/cu8pm ppQJREOtXr9m1lxdhHgHmv0Ba2UvBnCeLihr1foIgG2WZF5xQ7kx24nQEVHxao++RjQq K3JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TSBcAgGE; 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 eo2-20020ad45942000000b00531b56e9835si4573296qvb.79.2023.01.09.04.44.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:44: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=TSBcAgGE; 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 1pEqxl-0008WR-9R; Mon, 09 Jan 2023 07:09: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 1pEqxH-0008Op-OM for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:08:47 -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 1pEqxG-0005s9-6u for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:08:43 -0500 Received: by mail-wm1-x329.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so8818941wms.0 for ; Mon, 09 Jan 2023 04:08:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LUbM2ZYO9/VNz+sUlf1XOfM6SSTREiXg498MIdZvH+I=; b=TSBcAgGElrJTYkLT7iFpTJyC91qVcc7sPoO37GgSZ73dKuLXiIGsiP+gGqij0nX+iS Cl1w/wqOAjjshH8IDhCXXID+xTxLhgJY/8E5VJN+VDOv/LEbR9pRpnYwtU4eHWqZTRik ntub4zfRP88Is82oeBOjfJwx4ZOFYWdb7ARtWX9DGmji5ybvVAgbAaq88BctOVmbwt/d WF5mFyh5vjYi4e0OOkfa6peeWBI5BmuFpP6K2gWUxv3ncSu2aYaUzEB/HZYy90SnjUE1 F0FGquKBEtfqBCg9on2A96Lo5sKaGPc08jCe7+63zKYgEyFdVgRtU5EQ2mASDXWqmfuu SbZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LUbM2ZYO9/VNz+sUlf1XOfM6SSTREiXg498MIdZvH+I=; b=enhJhd+2DcL32sHl/x9dlMrLbzedM5PRJmIZd1DwG68VDN44xSUlu8fl4OuBTE/W/m oazdGMEvQJ5aPtE+5JK4KZYfD3uqd1yd46IM/E1GUPVNjLf2VO2ecu21TSTg9MiHRaX9 ytIR/9qP3N8muVFRW75Sb1cHIheT83GfFAchCPU7aWM+vyBk8CnUCin9vC/T8+qTqmN+ pA0S5wzeeIC9sCNG35WSB1uaTFz+LI0JNkZruzgLdgZH2mJnJpOpi58o4RfKEde0bzWr Nx9egi8KaXdc7ZSIivmZaZg9l+TZ5QXwJiGszHVIyzghhiyjvDXo0hWyTw5pMhuKW8xu f0bw== X-Gm-Message-State: AFqh2krqEJc2wV+vfbpijRkZasVNsTkGj4YBhfnDl4jd0N58xvXp/36p P1///S4/CDNphilbZuM3IkCPxjaN8NLlTlXS X-Received: by 2002:a05:600c:556f:b0:3d2:2a74:3a90 with SMTP id ja15-20020a05600c556f00b003d22a743a90mr48545553wmb.22.1673266120233; Mon, 09 Jan 2023 04:08:40 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id j6-20020a05600c42c600b003b492753826sm10622105wme.43.2023.01.09.04.08.39 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:08:39 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/21] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width' Date: Mon, 9 Jan 2023 13:08:13 +0100 Message-Id: <20230109120833.3330-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 Use the same property name than the TYPE_PFLASH_CFI01 model. Signed-off-by: Philippe Mathieu-Daudé --- hw/block/pflash_cfi02.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 2a99b286b0..55ddd0916c 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -949,7 +949,7 @@ static Property pflash_cfi02_properties[] = { DEFINE_PROP_UINT32("sector-length2", PFlashCFI02, sector_len[2], 0), DEFINE_PROP_UINT32("num-blocks3", PFlashCFI02, nb_blocs[3], 0), DEFINE_PROP_UINT32("sector-length3", PFlashCFI02, sector_len[3], 0), - DEFINE_PROP_UINT8("width", PFlashCFI02, width, 0), + DEFINE_PROP_UINT8("device-width", PFlashCFI02, width, 0), DEFINE_PROP_UINT8("mappings", PFlashCFI02, mappings, 0), DEFINE_PROP_UINT8("big-endian", PFlashCFI02, be, 0), DEFINE_PROP_UINT16("id0", PFlashCFI02, ident0, 0), @@ -1014,7 +1014,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base, assert(QEMU_IS_ALIGNED(size, sector_len)); qdev_prop_set_uint32(dev, "num-blocks", size / sector_len); qdev_prop_set_uint32(dev, "sector-length", sector_len); - qdev_prop_set_uint8(dev, "width", width); + qdev_prop_set_uint8(dev, "device-width", width); qdev_prop_set_uint8(dev, "mappings", nb_mappings); qdev_prop_set_uint8(dev, "big-endian", !!be); qdev_prop_set_uint16(dev, "id0", id0); From patchwork Mon Jan 9 12:08:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640636 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2108286pvb; Mon, 9 Jan 2023 04:37:20 -0800 (PST) X-Google-Smtp-Source: AMrXdXv9u6Up2BhoHF8MK6CXGUG1RbwJ/PVIvFZv/9o686I9PdTT2qp8+W335fponMpaF3rzU/f2 X-Received: by 2002:a05:6214:458f:b0:532:2ce4:4a9c with SMTP id op15-20020a056214458f00b005322ce44a9cmr6243542qvb.17.1673267840375; Mon, 09 Jan 2023 04:37:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267840; cv=none; d=google.com; s=arc-20160816; b=Qn6JdXO9Bi4FKS1BaKG3DFaIuO1r7wgnjiQrVbEOG8K6i8P4gb+oclUvp02Nm6jF6U DgCPZqdvUVPYwtlhnXF+IvUHwbFagCze5lfCNZkn94y0Uld0HHhXjNebHRJkv7kpdMnA xAVfeIyvotkHNUU2ZfBW+OXaOeEipxOAc2YHWQa65DHIGmFdP5ZmDM5Q58s80vzEo5zv l7PQ0pDsl9VG/q8O6Vx+1BwJdq4NXnnpWrxTPXOFQTulR5Cnc25p9bNJyO7Tj5jejSoZ YK5o7DqbbH2tgaZVh1RLPHQW4HVeXjDYPbQmnijF6SIm5bD+oT9biqpnEyFMCwk1z8Hh Rsww== 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=DDiIve9+U0UXUJTYIcIXbQymbtky2bheQmHzx8WN4+8=; b=ru/mmGo15/f+bfxVyRXgtDnNjhpeUX5qVRr4KahlACDSkGHnMV3K5O+1OAqM89RP5l VoDw0b9msCRLuN9NWWBLc+qJjeM3mFlXeIHuwHnY5pufuUTum6GrAYcyWjVz2uqLRX1Z ZMgaDoW7gSkOxtF1Pc1+6lvjcYTSgajAj9HXTL5Ffy/oXKL5ZNx9+ciBWZMA2CG+vnUx 2+d0RtynbzbbpjIk1oicIJT9oBUSaIp9Uk8bdvmILKnX4fVl+NnrYw5tAXQ+MssXVAu8 NOhAs7oCg8f6eus5HkZF2p7LGzHGrz35sX7lh7nWV15b90lOtPdXTNr5Tqvbx4DtbGS7 kH0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="z83dM/4k"; 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 gv11-20020a056214262b00b004c760aab60asi4397102qvb.493.2023.01.09.04.37.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:37: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="z83dM/4k"; 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 1pEqxl-0008WU-Px; Mon, 09 Jan 2023 07:09: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 1pEqxM-0008Pc-CQ for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:08:59 -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 1pEqxK-0005st-Hj for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:08:48 -0500 Received: by mail-wm1-x32d.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so8836263wmb.2 for ; Mon, 09 Jan 2023 04:08:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DDiIve9+U0UXUJTYIcIXbQymbtky2bheQmHzx8WN4+8=; b=z83dM/4keYHnqcTlSqT5e/Bn/IUyEx0niy5l9EOlu/pyk0VvSnzE9PmQHhcZqhKb3w hgywj42afHMcFEzPdEeXW2+VjIWSuGynSdkDZGGgMStd/jbHEGyMl+CJOZBNudYfs9jk WTVJ2N1LKHA6RCh2i+9mMnB2Xzj8ggEIGkN3ayo8BiriIIAqI4omo/JQY++QrlBtNSsw Nax40CDuKAsbfEx0CdISISEMvcmELjB22rfTXp6UKnAPPMOMSP+fRk6yQOBZ9zhOOWcm rj4f06GxtaQJz10M7nFtzeIaGmxUgpTdlRMJkGv9N3fuz2UAlo+R+C+X6KuWqoAu2Aoa LoSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DDiIve9+U0UXUJTYIcIXbQymbtky2bheQmHzx8WN4+8=; b=DEizPdyToQDN6fyBsA8Mo4R14+miT1Fa0TpkkLOByjfPtdoXy38Tc2yoB+fH0WfXG3 jc/3cXNReoVWNzCQFZhZ85mlHdHc3tmF68opP16JbOsVPLO5VUzXb2EYanMY9EMeQNYd ah/ZT1dD4fghAa1BRJVI2ctd4Fv+ZG/boFOgbemPVWR0aJmkR0qDFSf3JRdWjGBoyi5g /OBonee86MBdYZ/w7J7kM4OroOp4YhVFIZ5Iv8AO3SLY7AtcLeMFFaC44dE9YtdzAHT8 23+Ah7ZuCWkhVr18Jt53TeId1oNaMib030cRWoGkg4UYQKdXYuUu6n+bqcUC48FYtwv1 MCqw== X-Gm-Message-State: AFqh2kq7zNQnQ5cM+FruJitzCmqoskyyXQTt1gmvexMbuJ56fp4n9KJR IRAz8c/8iybO8WI/JYpXX52GuQhHsT+X9j6k X-Received: by 2002:a05:600c:3b82:b0:3cf:900c:de6b with SMTP id n2-20020a05600c3b8200b003cf900cde6bmr46285095wms.15.1673266124915; Mon, 09 Jan 2023 04:08:44 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id fc14-20020a05600c524e00b003a3442f1229sm17700259wmb.29.2023.01.09.04.08.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:08:44 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 02/21] hw/block: Pass DeviceState to pflash_cfi01_get_blk() Date: Mon, 9 Jan 2023 13:08:14 +0100 Message-Id: <20230109120833.3330-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 The point of a getter() function is to not expose the structure internal fields. Otherwise callers could simply access the PFlashCFI01::blk field. Have the callers pass a DeviceState* argument. The QOM type check is done in the callee. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/arm/sbsa-ref.c | 2 +- hw/arm/virt.c | 2 +- hw/block/pflash_cfi01.c | 4 +++- hw/i386/pc_sysfw.c | 4 ++-- include/hw/block/flash.h | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 4bb444684f..65b9acba04 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -346,7 +346,7 @@ static bool sbsa_firmware_init(SBSAMachineState *sms, sbsa_flash_map(sms, sysmem, secure_sysmem); - pflash_blk0 = pflash_cfi01_get_blk(sms->flash[0]); + pflash_blk0 = pflash_cfi01_get_blk(DEVICE(sms->flash[0])); bios_name = MACHINE(sms)->firmware; if (bios_name) { diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ea2413a0ba..954e3ca5ce 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1233,7 +1233,7 @@ static bool virt_firmware_init(VirtMachineState *vms, virt_flash_map(vms, sysmem, secure_sysmem); - pflash_blk0 = pflash_cfi01_get_blk(vms->flash[0]); + pflash_blk0 = pflash_cfi01_get_blk(DEVICE(vms->flash[0])); bios_name = MACHINE(vms)->firmware; if (bios_name) { diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 0cbc2fb4cb..458c50ec45 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -984,8 +984,10 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, return PFLASH_CFI01(dev); } -BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl) +BlockBackend *pflash_cfi01_get_blk(DeviceState *dev) { + PFlashCFI01 *fl = PFLASH_CFI01(dev); + return fl->blk; } diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index c8d9e71b88..4b85c48ec8 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -152,7 +152,7 @@ static void pc_system_flash_map(PCMachineState *pcms, for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { system_flash = pcms->flash[i]; - blk = pflash_cfi01_get_blk(system_flash); + blk = pflash_cfi01_get_blk(DEVICE(system_flash)); if (!blk) { break; } @@ -216,7 +216,7 @@ void pc_system_firmware_init(PCMachineState *pcms, for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { pflash_cfi01_legacy_drive(pcms->flash[i], drive_get(IF_PFLASH, 0, i)); - pflash_blk[i] = pflash_cfi01_get_blk(pcms->flash[i]); + pflash_blk[i] = pflash_cfi01_get_blk(DEVICE(pcms->flash[i])); } /* Reject gaps */ diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 86d8363bb0..961b6e9f74 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -21,7 +21,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, uint16_t id0, uint16_t id1, uint16_t id2, uint16_t id3, int be); -BlockBackend *pflash_cfi01_get_blk(PFlashCFI01 *fl); +BlockBackend *pflash_cfi01_get_blk(DeviceState *dev); MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl); void pflash_cfi01_legacy_drive(PFlashCFI01 *dev, DriveInfo *dinfo); From patchwork Mon Jan 9 12:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640641 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2113370pvb; Mon, 9 Jan 2023 04:48:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXvyvJXx9cFbBahBB3tn9aMVgjrjRZm5VWTVh0n5cOPdNsGUz9ymkBUqkIaZRo/KqyyOA0vx X-Received: by 2002:a05:622a:1146:b0:3ac:3bc3:8d0 with SMTP id f6-20020a05622a114600b003ac3bc308d0mr8349889qty.23.1673268528154; Mon, 09 Jan 2023 04:48:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268528; cv=none; d=google.com; s=arc-20160816; b=BlYtpMhuHWucgVougMH6DOQOqxDW0f4G/w4bLNi3CP9vICqWTo9uoU5QWqpCa5ajjO wU2jqH4UzFi80R/q1cmj8oqHRruwX+uV1dSeRhJ1S3+tvqVmCbd3gmOLHN3T2pMIIIyd 09lqSQuOYJs6VTpG8FNKoaKORtZ1HAU6II95zFH4Q5Tl69POn3JgO5mJ6ZFVuUIXyCyK DOtpKhd1Fo7KqQjwhwhnxjmVwyibmlmN+RlX+E3aTZaeGDNlQ1urb8152NfgTs8XkcdX fyhbAoSLb/EzjRkhRJAxF5oe37hSnwLr25o78LxzEybpA5vpWGX1Ym3C4W4+fQW2fTLv Gw9g== 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=qvR2r7mABa8twb5HuIROvIsigWOYnFpMS9gvKcFCIYA=; b=VRwL2PktVoUy3MUUI99cItl+9YAbc2ZaQhgDyuL54MPAofOnvvxaKDDiccShL2Jwei bGeSubQ6mhz1z2uvoHEhcuLzyvaKUs14UjM6wQzhrtHL1pQh3vUwUKbZgUvhXJZ9GZ8E JB7hVS7mRSkYcd/RU95maBv0KjQdXNIH+eyaWWgW80v0U+PmqnFt1dGrU6KCHyxpmTHc Yq4vCovONKhlHEZC11T1wmij9YWBYf1yrzbCDDDbAeiHzzf64zpiwYbkLwXBdeKkhAPN dCXC4T13vEQcM7LLQMqKgfH8cfhFcd767xJto879obQex7pVNTiy/bUHeAXYas2DkeLc MX1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V0TkCOiA; 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 p18-20020ac87412000000b003a5630d6ff4si4417897qtq.274.2023.01.09.04.48.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:48: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=V0TkCOiA; 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 1pEqxl-0008WO-8j; Mon, 09 Jan 2023 07:09: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 1pEqxR-0008QI-El for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:04 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqxP-0005to-BL for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:08:52 -0500 Received: by mail-wr1-x435.google.com with SMTP id r2so7924812wrv.7 for ; Mon, 09 Jan 2023 04:08:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qvR2r7mABa8twb5HuIROvIsigWOYnFpMS9gvKcFCIYA=; b=V0TkCOiAmrQn4f7JC3E1NCiCImiog0UjG65Tv8q36jnVsjH/FWfIaVW62T4UlGNvPe S2JpbGCkGG9dzG974Zv9lNPPqV6xrnMF2wER5XXIPVkb4PUD4mJaqRuAmWkk7HMRUoGx oBg6OBOugD2IuDtLL7IT5UssotD7MCQlXITRll7aSdgDyo7/V4sQAhIy2y1YcrILO407 HDgjr8tMRS6VcGTm0xpAI+JYAtLcIN2WgrBz534jp8R18xUA04EQLLlS45Sd/NRI+E3t E3phFdh/AW45aANvG3HU2B5cbGjL/aC/4CcrnBF0Ipb+bj7GVLeOCrbg0P1OBrJsGnxG U+Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qvR2r7mABa8twb5HuIROvIsigWOYnFpMS9gvKcFCIYA=; b=ZrTH/fgVkXG2nLKb3aAjs/Iqw8IEUPxZjpJSkHntqnNp9VOJASeZXmlpQUEImrhyx4 cux1aLQ0C0Dle/4ApqGhm5xBGtWG/t1P2s04UlhFe1JhUIXa+NRa83jT4B3j9er6vZWu YhfdDpBdKbhlE4i+Ty1TtSJfT3HselFQYiHerVcrgW5Wt0DX1amzZXxzUBEJ/yuigo2h Ryw9EY9b8RXwzLdKuU9+bCnWk9aLcNnkJCOuMQqaQ7SqT1mT8hhJg/HrAQHqG1Zx2wbn HUklh6i9W9kx4klv5GaFvIic/D5E6IiB9zV7xlyE4m31dMm3gl/WKm9BsX6PEuwwU9hz N8ig== X-Gm-Message-State: AFqh2krT+XhhZH8bFRbFVaWsUQQd8csCq4W2bH5SXD8+MV6SeFPHl0fq k1lzqx+O1NrEe9zOtOMtwY8zipedvK006W1U X-Received: by 2002:adf:f851:0:b0:2bc:7e19:fe84 with SMTP id d17-20020adff851000000b002bc7e19fe84mr1129699wrq.62.1673266129659; Mon, 09 Jan 2023 04:08:49 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id i2-20020adfdec2000000b002b9b9445149sm9871197wrn.54.2023.01.09.04.08.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:08:49 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 03/21] hw/block: Use pflash_cfi01_get_blk() in pflash_cfi01_legacy_drive() Date: Mon, 9 Jan 2023 13:08:15 +0100 Message-Id: <20230109120833.3330-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org By using pflash_cfi01_get_blk(), pflash_cfi01_legacy_drive() doesn't require any knowledge of the PFlashCFI01 structure. Thus we can pass a generic DeviceState pointer. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/arm/sbsa-ref.c | 2 +- hw/arm/virt.c | 2 +- hw/block/pflash_cfi01.c | 6 +++--- hw/i386/pc_sysfw.c | 2 +- hw/riscv/virt.c | 2 +- include/hw/block/flash.h | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 65b9acba04..1d29e8ca7f 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -340,7 +340,7 @@ static bool sbsa_firmware_init(SBSAMachineState *sms, /* Map legacy -drive if=pflash to machine properties */ for (i = 0; i < ARRAY_SIZE(sms->flash); i++) { - pflash_cfi01_legacy_drive(sms->flash[i], + pflash_cfi01_legacy_drive(DEVICE(sms->flash[i]), drive_get(IF_PFLASH, 0, i)); } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 954e3ca5ce..57726b0f52 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1227,7 +1227,7 @@ static bool virt_firmware_init(VirtMachineState *vms, /* Map legacy -drive if=pflash to machine properties */ for (i = 0; i < ARRAY_SIZE(vms->flash); i++) { - pflash_cfi01_legacy_drive(vms->flash[i], + pflash_cfi01_legacy_drive(DEVICE(vms->flash[i]), drive_get(IF_PFLASH, 0, i)); } diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 458c50ec45..8beba24989 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -1002,7 +1002,7 @@ MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl) * Else if @fl's property "drive" is already set, fatal error. * Else set it to the BlockBackend with @dinfo. */ -void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, DriveInfo *dinfo) +void pflash_cfi01_legacy_drive(DeviceState *dev, DriveInfo *dinfo) { Location loc; @@ -1012,11 +1012,11 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, DriveInfo *dinfo) loc_push_none(&loc); qemu_opts_loc_restore(dinfo->opts); - if (fl->blk) { + if (pflash_cfi01_get_blk(dev)) { error_report("clashes with -machine"); exit(1); } - qdev_prop_set_drive_err(DEVICE(fl), "drive", blk_by_legacy_dinfo(dinfo), + qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(dinfo), &error_fatal); loc_pop(&loc); } diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 4b85c48ec8..c08cba6628 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -214,7 +214,7 @@ void pc_system_firmware_init(PCMachineState *pcms, /* Map legacy -drive if=pflash to machine properties */ for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { - pflash_cfi01_legacy_drive(pcms->flash[i], + pflash_cfi01_legacy_drive(DEVICE(pcms->flash[i]), drive_get(IF_PFLASH, 0, i)); pflash_blk[i] = pflash_cfi01_get_blk(DEVICE(pcms->flash[i])); } diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 94ff2a1584..aa8db65685 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1514,7 +1514,7 @@ static void virt_machine_init(MachineState *machine) for (i = 0; i < ARRAY_SIZE(s->flash); i++) { /* Map legacy -drive if=pflash to machine properties */ - pflash_cfi01_legacy_drive(s->flash[i], + pflash_cfi01_legacy_drive(DEVICE(s->flash[i]), drive_get(IF_PFLASH, 0, i)); } virt_flash_map(s, system_memory); diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 961b6e9f74..701a2c1701 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -23,7 +23,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, int be); BlockBackend *pflash_cfi01_get_blk(DeviceState *dev); MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl); -void pflash_cfi01_legacy_drive(PFlashCFI01 *dev, DriveInfo *dinfo); +void pflash_cfi01_legacy_drive(DeviceState *dev, DriveInfo *dinfo); /* pflash_cfi02.c */ From patchwork Mon Jan 9 12:08:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640635 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2107468pvb; Mon, 9 Jan 2023 04:35:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXudpYUTojnGOECInCK5hE4bYaK0FT7+ZbX+d3CvuaSZNy9Ky04tOXfVZVQiHD/tdRYs43h8 X-Received: by 2002:a0c:f30a:0:b0:520:fc8f:dcf5 with SMTP id j10-20020a0cf30a000000b00520fc8fdcf5mr99644613qvl.33.1673267727965; Mon, 09 Jan 2023 04:35:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267727; cv=none; d=google.com; s=arc-20160816; b=xNhhwBGhNftMfMiyyNM0DIerJIaC2OemTiWVQ4khfQKnfw/e0HUIqo9QXMdWQwQpB1 azMErH2YheuGQRt4jrcZSzqlcxU6c/BgUVRxZkGtmTDhT7MmxZaoBtLccMHPc+9jtyeP 4l95EWFLkw07vkAO9D1FzwDQkPdC7caXid4F1jHX3EtHJVWlr2jXvjws5DY3H9fLYvmX ldepYWMCSqjD0gMxxKp+qRUSebNONG4Z4oeXup24XpykMerld6PFTE/4pvxwcGrB50hc 5leGMVGZGEfAQ9fHRIhiMLNIRlzRn90mNg1ok5lVKWJP2jQ5XSBnOL+Uyd4L9+2Wa/BE wHnQ== 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=ayDdN6M5SazcUk4shwb3UZYWrM6pyYZwkB3Sw1AVCg0=; b=vFPF69OWrDQZczF5GS6VGfkaml2nfr1EKpmJOHZtgkiysLjv4OmYN2P5Ym12bEFmBq l6439P6tJxjIgJdSop7gXyOPA8584CzukNhvFUmBfzU6SLp6pWco2d/64jt+XhSZkJvh KsqBvEcsJPMvQJW1kmPVXkzZKFVi3aIk3X5qblzCEkEq3kIHul9VOytC4MdCW8R9Z+Hn Wka3YjBjayfMdndjtbI528cwwiRAuUx4ZFyV6tlPw8S1EU7qerD1lDyIrxQtcLuV3sOH w0iPJZ98U4lw4214jesFzAP4MTPtTfvTotaPh36j5eQQ8Ioc9uzGfjuD2oyM/VmY6rzp /Yfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WgXi4yM4; 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 hu15-20020a056214234f00b00531b1fbd00asi4306523qvb.257.2023.01.09.04.35.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:35: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=WgXi4yM4; 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 1pEqxp-00005r-3J; Mon, 09 Jan 2023 07:09: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 1pEqxZ-0008Rm-72 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:09 -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 1pEqxW-0005uo-1D for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:00 -0500 Received: by mail-wr1-x431.google.com with SMTP id s9so7921605wru.13 for ; Mon, 09 Jan 2023 04:08:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ayDdN6M5SazcUk4shwb3UZYWrM6pyYZwkB3Sw1AVCg0=; b=WgXi4yM4j2ZAAR77wtctBBmGYF5P8Xuff1uG1iDJeCcY3khoa0+HNuYhFqDCMhSDps QtHvSJ1rB19SdykJ5ARrm07smC3nS40sVLAGvU0wjRrIhN7s/IvplWw98wN81wwI/NKf YyWmnVXd/RNuzNb3Ef5GFF7jeKG7WeZeca9+awI83Rg5OPM77j9oRsgFhhvoIb7u5BGK qY+ytbagDxcsH62efkaGcDpx3ATcAm64W62hKjLDxmadAt4WJ7LIQNntnMCvDmA+qXYI GxmdfbUKXjQhjYdM9pF54jszvVBPYS5K7ubVu6VgXApgNdb7UlEBV245BPonEKlJmprZ 9aTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ayDdN6M5SazcUk4shwb3UZYWrM6pyYZwkB3Sw1AVCg0=; b=OL63S2JHWiVoUwcPWYJT3V4nNQIZcB1ilkrjI3jczqr0JUWtNn65IGLzm/mnhllbpF daCPXzF7nG0J8yw9rue6MqOkzbz33IOq61hD0njp9eZeSbubDyDmVOZUheJow/uYEX80 LgoQRo3WEWUxjm1P0uhtnha7PZj0dwM4NgxCgD5YNYvdKrZcCOhTE2vFoPrUE5FRm9Il JzLYGCFHsR0Dl50UMzM/PY0tc94WVjycKdPvLK9nmjIIHCynIOg06/cQCNzNspSq3nDj t+ex+6sVMwQSF6Z54Re1lzg1q9E2V4Kk4vr2i2BObHl9+oCiQSkDRscspGKVaLQmaumL Xlvw== X-Gm-Message-State: AFqh2koj/vXlRVAWsoeUGMJ0xALTkCWV42KU+RMmwHwhDGbymMWEyy/2 KJ9SprRvyawOT4E1E5K6FbPZVmMgHz2YYMgN X-Received: by 2002:a5d:4a89:0:b0:2b0:17a0:a255 with SMTP id o9-20020a5d4a89000000b002b017a0a255mr9995035wrq.15.1673266134401; Mon, 09 Jan 2023 04:08:54 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t17-20020a05600001d100b00241d21d4652sm8367155wrx.21.2023.01.09.04.08.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:08:54 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 04/21] hw/block: Pass DeviceState to pflash_cfi01_get_memory() Date: Mon, 9 Jan 2023 13:08:16 +0100 Message-Id: <20230109120833.3330-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 The point of a getter() function is to not expose the structure internal fields. Otherwise callers could simply access the PFlashCFI01::mem field. Have the callers pass a DeviceState* argument. The QOM type check is done in the callee. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/block/pflash_cfi01.c | 4 +++- hw/i386/pc_sysfw.c | 2 +- hw/mips/malta.c | 3 ++- hw/ppc/e500.c | 2 +- hw/xtensa/xtfpga.c | 2 +- include/hw/block/flash.h | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 8beba24989..866ea596ea 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -991,8 +991,10 @@ BlockBackend *pflash_cfi01_get_blk(DeviceState *dev) return fl->blk; } -MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl) +MemoryRegion *pflash_cfi01_get_memory(DeviceState *dev) { + PFlashCFI01 *fl = PFLASH_CFI01(dev); + return &fl->mem; } diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index c08cba6628..60db0efb41 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -187,7 +187,7 @@ static void pc_system_flash_map(PCMachineState *pcms, 0x100000000ULL - total_size); if (i == 0) { - flash_mem = pflash_cfi01_get_memory(system_flash); + flash_mem = pflash_cfi01_get_memory(DEVICE(system_flash)); pc_isa_bios_init(rom_memory, flash_mem, size); /* Encrypt the pflash boot ROM */ diff --git a/hw/mips/malta.c b/hw/mips/malta.c index e645ba1322..9657f7f6da 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1292,7 +1292,8 @@ void mips_malta_init(MachineState *machine) dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, FLASH_SECTOR_SIZE, 4, 0x0000, 0x0000, 0x0000, 0x0000, be); - bios = pflash_cfi01_get_memory(fl); + dev = DEVICE(fl); + bios = pflash_cfi01_get_memory(dev); fl_idx++; if (kernel_filename) { ram_low_size = MIN(ram_size, 256 * MiB); diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 9fa1f8e6cf..b127068431 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -1144,7 +1144,7 @@ void ppce500_init(MachineState *machine) sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); memory_region_add_subregion(&pms->pbus_dev->mmio, 0, - pflash_cfi01_get_memory(PFLASH_CFI01(dev))); + pflash_cfi01_get_memory(dev)); } /* diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 2a5556a35f..bce3a543b0 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -459,7 +459,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) } } else { if (flash) { - MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash); + MemoryRegion *flash_mr = pflash_cfi01_get_memory(DEVICE(flash)); MemoryRegion *flash_io = g_malloc(sizeof(*flash_io)); uint32_t size = env->config->sysrom.location[0].size; diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 701a2c1701..25affdf7a5 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -22,7 +22,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, uint16_t id2, uint16_t id3, int be); BlockBackend *pflash_cfi01_get_blk(DeviceState *dev); -MemoryRegion *pflash_cfi01_get_memory(PFlashCFI01 *fl); +MemoryRegion *pflash_cfi01_get_memory(DeviceState *dev); void pflash_cfi01_legacy_drive(DeviceState *dev, DriveInfo *dinfo); /* pflash_cfi02.c */ From patchwork Mon Jan 9 12:08:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640640 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2111790pvb; Mon, 9 Jan 2023 04:45:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXsHNZZa+eQlglYRSo8OBDiijoDVZa0xowPrRLyv0wrswYj5FuTBvz+raQu81lnHSYmfb4Da X-Received: by 2002:ac8:706:0:b0:3a8:199b:dcaf with SMTP id g6-20020ac80706000000b003a8199bdcafmr88376855qth.17.1673268327835; Mon, 09 Jan 2023 04:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268327; cv=none; d=google.com; s=arc-20160816; b=CtQ/vAVEqQRFNraR02SdtbPY4U7wqzNM+qGKGLZqbeGTM38jyp4vu+qGMA9XWgyuTh +EwyGQuMyxAWH6S8PXtkPHCs6h3/vcFfrOqggQtS/YdEvoNi7w3+RpRxH/L3/Cu/z7CI mpoM1NHl2cpSyOXlm296w2qTPwpeyADWWFemsQuAEqoFiAHW8klnXVBmHyMo4IYT2ZJw K5hNqQraDoZ/NNRzPiMVQARlzw58R/i7H5FFCOq/2mow2ds9LKszf1EqvGDRbUiJtPB+ gXPDaWnq1dgWspC1p4HeTD+lP8LBDsi9FXqEFg2WIzmpqnqbmORznlNDlVvf7wpLKdjv YmtQ== 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=YmWTgYpjzFxLJgTFXyJSPWbDedSuFpqteXaP2VxVj1k=; b=JWeCCTrgZzrFZC0k/C0H4gAIIc6ceD2NFhKP5QOmAHLxjUnDgmmI16jmQqG1vzaMR1 6PvuNWL35E8xXiqZJX2vG7kd5XYfg0P9bKULbEuVgOkZHhbtlhbqyAWzD8KVVHZV3VFx NQzbIlPStHqQ/7bTIfolX7G9G6Up/QOReyDJMsQS0Hlvr+uNbzvZFTMgQg28BdQ9uRxD lWDpWAEvqtLFZMfIa3QgPihf+5J/Uu4G0aAD/Cz2HCrgDWfnb4ZHJ1Ol5+6bhCm9PVcX TMOPsC0plAdAseztJUKrTtFBqUedsMXv00nBxrOR9YBN004m/LyI3WBhYdiHdWh/PodT EdWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OKqh6KgM; 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 m7-20020ac866c7000000b003a7f597c01asi4361795qtp.787.2023.01.09.04.45.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:45: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=OKqh6KgM; 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 1pEqxn-00005R-RM; Mon, 09 Jan 2023 07:09:16 -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 1pEqxc-0008SN-JN for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:09 -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 1pEqxZ-0005vu-0r for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:03 -0500 Received: by mail-wr1-x42a.google.com with SMTP id m7so7918749wrn.10 for ; Mon, 09 Jan 2023 04:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YmWTgYpjzFxLJgTFXyJSPWbDedSuFpqteXaP2VxVj1k=; b=OKqh6KgMT3hOK1Vs3PyaDnAbyJbSGSdXuKkXDrjMgSCC+8e2DvrNOSoXS4Cl6of0dE hqvrWoKwnu/P8TuewkssFPC2fhSvigw2SPwIHAeFlztvhq+z24hfTsAkR6lmSo4CAb38 YgSTP9PSvY+1tiwI9+G1onAk1PZtjPZEex3+Nr0xzJ2xLSD00jFPizMYccrN3O8SnJ0O TA01YKpe+Svq0OaOXlNo+qE8uBav90RiWbIyOguBqvP5Q0Ipecske7lyStu25VVTIGUN 3Xb35agv3p2UgYPw8TLO+9j+Zq76O4a7AnJTDnEeNZ3xM84G8GPdEFEmlr/ZVXLor6Z2 ozqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YmWTgYpjzFxLJgTFXyJSPWbDedSuFpqteXaP2VxVj1k=; b=5bSMMB+0M6K0pHT5kD/TBVzAlmzYa4AJi0BRCtUSaVkuRSOemG5uPhVIKB6UJVOZ0c qTPZxE3LvDkZYQv7PaLnq44P9UcKO7oKlk6U45zpGJKxGzWvF4Jj6Jgvvn6CbOPomySK skBxYj89Td+sSsvvtANkdepq8g4waUpAtVl2du6ZQw9FXg7k6vv4Ojdum28Ha7ZOF61N +/XNVCGTuZu3Mrx8U7/XQLWXdUO6Qw0iU1AbVRT2/xe/azCpRfc+XfHEAKRTwXhONWHt xx83xYKXStkeR1r4sqqvaSlxUA0XAultbC1Ak2iW3YP01DgUv3QfaaOdS2dwFmO/vftx +TCw== X-Gm-Message-State: AFqh2kqJXGWajKkdnEhb2gazm8xcTGWBLEOk6qAav/YGtNzQW1BOdx/2 lI0E66hlV2jbqJzOl6Ro2tMtNHe2Pcdr5rtf X-Received: by 2002:a5d:4143:0:b0:290:3629:a824 with SMTP id c3-20020a5d4143000000b002903629a824mr25675342wrq.40.1673266139342; Mon, 09 Jan 2023 04:08:59 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id q11-20020adf9dcb000000b00268aae5fb5bsm8533302wre.3.2023.01.09.04.08.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:08:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 05/21] hw/arm: Use generic DeviceState instead of PFlashCFI01 Date: Mon, 9 Jan 2023 13:08:17 +0100 Message-Id: <20230109120833.3330-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 Nothing here requires access to PFlashCFI01 internal fields: use the inherited generic DeviceState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/arm/sbsa-ref.c | 12 ++++++------ hw/arm/vexpress.c | 10 ++++------ hw/arm/virt.c | 10 +++++----- include/hw/arm/virt.h | 3 +-- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 1d29e8ca7f..8e60e0e58d 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -91,7 +91,7 @@ struct SBSAMachineState { int fdt_size; int psci_conduit; DeviceState *gic; - PFlashCFI01 *flash[2]; + DeviceState *flash[2]; }; #define TYPE_SBSA_MACHINE MACHINE_TYPE_NAME("sbsa-ref") @@ -264,7 +264,7 @@ static void create_fdt(SBSAMachineState *sms) #define SBSA_FLASH_SECTOR_SIZE (256 * KiB) -static PFlashCFI01 *sbsa_flash_create1(SBSAMachineState *sms, +static DeviceState *sbsa_flash_create1(SBSAMachineState *sms, const char *name, const char *alias_prop_name) { @@ -286,7 +286,7 @@ static PFlashCFI01 *sbsa_flash_create1(SBSAMachineState *sms, object_property_add_child(OBJECT(sms), name, OBJECT(dev)); object_property_add_alias(OBJECT(sms), alias_prop_name, OBJECT(dev), "drive"); - return PFLASH_CFI01(dev); + return dev; } static void sbsa_flash_create(SBSAMachineState *sms) @@ -295,7 +295,7 @@ static void sbsa_flash_create(SBSAMachineState *sms) sms->flash[1] = sbsa_flash_create1(sms, "sbsa.flash1", "pflash1"); } -static void sbsa_flash_map1(PFlashCFI01 *flash, +static void sbsa_flash_map1(DeviceState *flash, hwaddr base, hwaddr size, MemoryRegion *sysmem) { @@ -340,13 +340,13 @@ static bool sbsa_firmware_init(SBSAMachineState *sms, /* Map legacy -drive if=pflash to machine properties */ for (i = 0; i < ARRAY_SIZE(sms->flash); i++) { - pflash_cfi01_legacy_drive(DEVICE(sms->flash[i]), + pflash_cfi01_legacy_drive(sms->flash[i], drive_get(IF_PFLASH, 0, i)); } sbsa_flash_map(sms, sysmem, secure_sysmem); - pflash_blk0 = pflash_cfi01_get_blk(DEVICE(sms->flash[0])); + pflash_blk0 = pflash_cfi01_get_blk(sms->flash[0]); bios_name = MACHINE(sms)->firmware; if (bios_name) { diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 757236767b..a35472e7e2 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -508,7 +508,7 @@ static void vexpress_modify_dtb(const struct arm_boot_info *info, void *fdt) /* Open code a private version of pflash registration since we * need to set non-default device width for VExpress platform. */ -static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name, +static DeviceState *ve_pflash_cfi01_register(hwaddr base, const char *name, DriveInfo *di) { DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01); @@ -531,7 +531,7 @@ static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name, sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - return PFLASH_CFI01(dev); + return dev; } static void vexpress_common_init(MachineState *machine) @@ -543,7 +543,6 @@ static void vexpress_common_init(MachineState *machine) qemu_irq pic[64]; uint32_t sys_id; DriveInfo *dinfo; - PFlashCFI01 *pflash0; I2CBus *i2c; ram_addr_t vram_size, sram_size; MemoryRegion *sysmem = get_system_memory(); @@ -657,12 +656,11 @@ static void vexpress_common_init(MachineState *machine) sysbus_create_simple("pl111", map[VE_CLCD], pic[14]); dinfo = drive_get(IF_PFLASH, 0, 0); - pflash0 = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0", - dinfo); + dev = ve_pflash_cfi01_register(map[VE_NORFLASH0], "vexpress.flash0", dinfo); if (map[VE_NORFLASHALIAS] != -1) { /* Map flash 0 as an alias into low memory */ - flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(pflash0), 0); + flash0mem = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); memory_region_init_alias(flashalias, NULL, "vexpress.flashalias", flash0mem, 0, VEXPRESS_FLASH_SIZE); memory_region_add_subregion(sysmem, map[VE_NORFLASHALIAS], flashalias); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 57726b0f52..e47070105d 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1105,7 +1105,7 @@ static void create_virtio_devices(const VirtMachineState *vms) #define VIRT_FLASH_SECTOR_SIZE (256 * KiB) -static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms, +static DeviceState *virt_flash_create1(VirtMachineState *vms, const char *name, const char *alias_prop_name) { @@ -1127,7 +1127,7 @@ static PFlashCFI01 *virt_flash_create1(VirtMachineState *vms, object_property_add_child(OBJECT(vms), name, OBJECT(dev)); object_property_add_alias(OBJECT(vms), alias_prop_name, OBJECT(dev), "drive"); - return PFLASH_CFI01(dev); + return dev; } static void virt_flash_create(VirtMachineState *vms) @@ -1136,7 +1136,7 @@ static void virt_flash_create(VirtMachineState *vms) vms->flash[1] = virt_flash_create1(vms, "virt.flash1", "pflash1"); } -static void virt_flash_map1(PFlashCFI01 *flash, +static void virt_flash_map1(DeviceState *flash, hwaddr base, hwaddr size, MemoryRegion *sysmem) { @@ -1227,13 +1227,13 @@ static bool virt_firmware_init(VirtMachineState *vms, /* Map legacy -drive if=pflash to machine properties */ for (i = 0; i < ARRAY_SIZE(vms->flash); i++) { - pflash_cfi01_legacy_drive(DEVICE(vms->flash[i]), + pflash_cfi01_legacy_drive(vms->flash[i], drive_get(IF_PFLASH, 0, i)); } virt_flash_map(vms, sysmem, secure_sysmem); - pflash_blk0 = pflash_cfi01_get_blk(DEVICE(vms->flash[0])); + pflash_blk0 = pflash_cfi01_get_blk(vms->flash[0]); bios_name = MACHINE(vms)->firmware; if (bios_name) { diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index c7dd59d7f1..817b43b248 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -34,7 +34,6 @@ #include "qemu/notify.h" #include "hw/boards.h" #include "hw/arm/boot.h" -#include "hw/block/flash.h" #include "sysemu/kvm.h" #include "hw/intc/arm_gicv3_common.h" #include "qom/object.h" @@ -142,7 +141,7 @@ struct VirtMachineState { Notifier machine_done; DeviceState *platform_bus_dev; FWCfgState *fw_cfg; - PFlashCFI01 *flash[2]; + DeviceState *flash[2]; bool secure; bool highmem; bool highmem_compact; From patchwork Mon Jan 9 12:08:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640620 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2101034pvb; Mon, 9 Jan 2023 04:20:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXslQct6uumWR2vYUfV1/bT/ME3pqk0O5q6zEdmIzzhmBt8U8qvhWXQPygEGe+d5vfVdKlsN X-Received: by 2002:ac8:460c:0:b0:3a7:f86a:a516 with SMTP id p12-20020ac8460c000000b003a7f86aa516mr84526243qtn.10.1673266821670; Mon, 09 Jan 2023 04:20:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266821; cv=none; d=google.com; s=arc-20160816; b=PAd3MC4R/1Q6yk/QSrPxAiW9H586R3VfVSQkQKMrzCVdndM/GCs9syCggnnBsz3Gd6 qBRgHsajDzcfsUkIs7RebEgiQvnRDfIh2SOxLraws6tPrAEQj02BunPmahf8/qOqB8w1 vuycCPMahGl3f/BQPFt+ZuXvQunpzfk/J1O2qWyQPnh3rPTBpwulVZ1U5UDl2Z07Q9ZO /XioWd+fUzDOucTZKj1KB4Ben5wb95B73RobKHa2PMTwRwFcE2NuxIN2xYFPFbxKWQdR bmzkXCTdMYF0dbfYyCPBpc5R6TTk/qkcJ45tGLAc4zpsJN4PUfcyn99d1Huel/qZNFec bw4Q== 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=S4cud4ppXnyk17bEaq5VSmXBPwLOn0gth9utfOZrsBY=; b=fGdEeOy1yOV2cnENEf49iFXEJlIegdUIqjLhYs6EkxUry9nV0oWIWE0qIKJmISHdPd umPI9N6J9uvMJpHl8WLlwws2xfnu0S6DNN5BZZtxmz3lRmNXMn9457/53sR1Hj3GtSLZ QK/UbPTzO2xY/fSgVBO3PKIetS1DHOcCtlr5Qx/OH6CwSAl26LxaFv6oXsLqbgOYfSOC COmheXYECGiWTt+BJMEe3b/xUoBl5GmtyQW+x07qMcw330RgqY5XQpH1wsiPXRCHivlw V/xY5giBunmkt6cwPuJprdjLZDKLBYlzL5v+qRFHTzzwanfewj6oFvEqO0Fchx+dOTAe pocw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xxwLSGC2; 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 k21-20020ac84795000000b003ab911a09fdsi4241970qtq.405.2023.01.09.04.20.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:20: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=xxwLSGC2; 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 1pEqxn-00005K-AM; Mon, 09 Jan 2023 07:09: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 1pEqxf-0008Sd-Bp for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:09 -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 1pEqxd-0005wv-K1 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:06 -0500 Received: by mail-wr1-x433.google.com with SMTP id bn26so7956995wrb.0 for ; Mon, 09 Jan 2023 04:09:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S4cud4ppXnyk17bEaq5VSmXBPwLOn0gth9utfOZrsBY=; b=xxwLSGC2YA4J38rQJxkaIr3adjQI6/fwtFk5BcvV+CdInzBLHgXP1LlQyaZ2izu+tt GmaSIRAvIYgmX5+Ez79jXoDL62qe43n5ynDj3Zlmfc72rEKyMkBiajXd4Ab0Qadqrnsm nLt2wG0R8zvY8uhIwZQpK/hF6pP9ZA521qSqbZvwfsHAiK3Cvqev1ngQSECnlf7f50tE fgOSueXyY/LWBBup/Izy/SwEm77BEZEEdHDxVAYUM/lFkwof/l0MDlmy108Wf4dt4pWB wiOG8iEYoqRXMeKlLFNdt+Ph5zKYe/7awBYAtoCIhQFKH7v/31KkcWTVF74XGzjX7SWw pI5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S4cud4ppXnyk17bEaq5VSmXBPwLOn0gth9utfOZrsBY=; b=Ih6pox/iepC//gCIGWrjoehIRlCzuIHn6vA2Ve0ah7G6/a767aAVfTibK3XRbBlhql orvyxcMqIPSQp+NnEkMK+u7GR2HcyhQdBBWsUC/O4YH9sb1LJsZUClRLGwcd9bpttdM1 6zdH3zEAkbhmQ9OfHM9rzvO+cYVnhG0qyDxWbdnS0pdKPoty/Uxk3wfUn+0/mje51V+6 AKpI+aEHnM4ttatoOAb5ncn2e3bP1LUB+Avnxyb6l3R6Z1UqC64nMlM+e90CIw6LguLt i+5iUw7If6WdXirBKxUaHEHaJyWMRXqWZuRegNxncJ9jLPaC6ReJtBGX9jWz59qEEwT2 nVHg== X-Gm-Message-State: AFqh2kqtszRXTITTsCwQ4rjRwDuZMJnAnDWs2jLzrWOQWEfzBlFEII8e req2vCzM3t5IQsHEbJIWxqrhmml6IOxUybHK X-Received: by 2002:a5d:404b:0:b0:288:9c64:e39 with SMTP id w11-20020a5d404b000000b002889c640e39mr26678800wrp.66.1673266144061; Mon, 09 Jan 2023 04:09:04 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id s1-20020a5d4ec1000000b002882600e8a0sm8510550wrv.12.2023.01.09.04.09.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 06/21] hw/loongarch: Use generic DeviceState instead of PFlashCFI01 Date: Mon, 9 Jan 2023 13:08:18 +0100 Message-Id: <20230109120833.3330-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 Nothing here requires access to PFlashCFI01 internal fields: use the inherited generic DeviceState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/loongarch/virt.c | 9 ++++----- include/hw/loongarch/virt.h | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 66be925068..0655e48c42 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -45,7 +45,7 @@ #include "sysemu/block-backend.h" #include "hw/block/flash.h" -static void virt_flash_create(LoongArchMachineState *lams) +static DeviceState *virt_flash_create(LoongArchMachineState *lams) { DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01); @@ -62,14 +62,13 @@ static void virt_flash_create(LoongArchMachineState *lams) object_property_add_alias(OBJECT(lams), "pflash", OBJECT(dev), "drive"); - lams->flash = PFLASH_CFI01(dev); + return dev; } static void virt_flash_map(LoongArchMachineState *lams, MemoryRegion *sysmem) { - PFlashCFI01 *flash = lams->flash; - DeviceState *dev = DEVICE(flash); + DeviceState *dev = lams->flash; hwaddr base = VIRT_FLASH_BASE; hwaddr size = VIRT_FLASH_SIZE; @@ -904,7 +903,7 @@ static void loongarch_machine_initfn(Object *obj) lams->acpi = ON_OFF_AUTO_AUTO; lams->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6); lams->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); - virt_flash_create(lams); + lams->flash = virt_flash_create(lams); } static bool memhp_type_supported(DeviceState *dev) diff --git a/include/hw/loongarch/virt.h b/include/hw/loongarch/virt.h index f5f818894e..519b25c722 100644 --- a/include/hw/loongarch/virt.h +++ b/include/hw/loongarch/virt.h @@ -12,7 +12,6 @@ #include "hw/boards.h" #include "qemu/queue.h" #include "hw/intc/loongarch_ipi.h" -#include "hw/block/flash.h" #define LOONGARCH_MAX_VCPUS 4 @@ -52,7 +51,7 @@ struct LoongArchMachineState { int fdt_size; DeviceState *platform_bus_dev; PCIBus *pci_bus; - PFlashCFI01 *flash; + DeviceState *flash; }; #define TYPE_LOONGARCH_MACHINE MACHINE_TYPE_NAME("virt") From patchwork Mon Jan 9 12:08:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640613 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2098107pvb; Mon, 9 Jan 2023 04:13:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXvl20fE3oaHeZhaDUXihtoAErOuizxWaW/2uuCS7OrW+QhlbHsxmH+ds/jKiu/GlVpVIs7r X-Received: by 2002:a05:6214:2b90:b0:532:2c0e:412a with SMTP id kr16-20020a0562142b9000b005322c0e412amr7738804qvb.52.1673266421601; Mon, 09 Jan 2023 04:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266421; cv=none; d=google.com; s=arc-20160816; b=xRG+tA4xULa5iDw171AaQYPxkVB0iayjhIViH0LreuhMDcGozJX9wMwyXO6fERFauC 9UQH0O7VAuGI4mQe7g4NqIqgRLQs7w0B5aUCOBqTXs4vvLob19QL3ME/cCF9s2/IhV8q nitlUuWYEB7sNQzG68INucxIu7W0KgSfDAU5PxZBnX1PVxQDVwJBf6ghng59m6DkBRHW KewWV+Q5Dz5/my3TzUVJZr8EU+mpstRLiuPjFQesfHZllpW6PxAmWAc0+8CAEzfOlZXK claChpvWdoM/zlZSQO27KclqoAVz04ekpiYa9ulrkC8U+fWOdPXPiBObyqtRUBIfJt1+ 3DOw== 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=RlZzQsn6LG39OnRXiNzAdXltRv/HPGk8unzxKgnfU6M=; b=sbtHzXS3ZBji+UATe89G5dM6cTjDq7tQOcb2x1xR3Acle8ycpVNsVljfEeM4R1vnnQ Vf7cTyk1DUWLyqOo79pNKJByKSgrRlV3Gge/GMo69lx2eDkLeMeQLvn319SpV68Zjy4R CqlHGoeIxa1/nXzXqUmwEjBY6lfWwNpuftfSw8HusUQE4t3+Hpsa4uJyGBiYSzKqRrOj bUty7PZuicug/xbas4vFnTCn/+4GqvLPrZoXzn4zmSEIlPepFIuP3GbwMLtk5QjvXloq RmgrpblBPETbHOy8rIUu7BVd6BHRuA/t9ubcez050VEYpFqNc0ULqjyDJzuWMB3Zs2LC RC0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dO0T4HaZ; 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 if10-20020a0562141c4a00b004c705fa72d4si4667234qvb.319.2023.01.09.04.13.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:13: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=dO0T4HaZ; 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 1pEqxo-00005Y-S6; Mon, 09 Jan 2023 07:09:16 -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 1pEqxk-0008W2-6h for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:12 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqxi-0005zG-Iv for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:11 -0500 Received: by mail-wm1-x334.google.com with SMTP id z8-20020a05600c220800b003d33b0bda11so7017346wml.0 for ; Mon, 09 Jan 2023 04:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RlZzQsn6LG39OnRXiNzAdXltRv/HPGk8unzxKgnfU6M=; b=dO0T4HaZ9g5WFHME+0loKXa6sUjYWH+rPgUokm3oskdePX6NGY+UrljVjwILlkI86P qMbW4upTk1lcz2IAQgQs0PXHUs0qLSFP2JMKCDcGYLcxaKTIpjfOIUyfofJUciW6x4kx AG7maSg7s+CDfVwfXSaib7bcGAA+BwWax+ztCXsEkhUsbV/YeyptPokqmlJMx5uamqbP XiAEJuJ9DYJauLwm9dKWTNGlSX7oZ3RrWfkLNdEV3K+9xrCPMasSSwwNwbidCI3uv5K7 4AiEl27XrcieKxambVpSDXVXiLGP7kRvXuYozstimXLdjc/WMWGH4pL+Tz8o2O0+aglQ mhOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RlZzQsn6LG39OnRXiNzAdXltRv/HPGk8unzxKgnfU6M=; b=b+JdRvGACwGAG7HKRmZKMAcJgdsg4dNIDyCSmQZDId+f3DDgaHLO71GKxYNuGiX896 W0yFdHM22e2mrKVEGFG7KHvB1aVCKAz7cfoDocc4O3HQqLdw8O5BlzwTmd5io7dPA35X /s2JKW3jayxPHOEa6bN8JIeuVmaZY7v4nrjQOU3PJ/WIclSW4nTfFPIm1oAKSxxXIhg/ I3gTzPNCDjwdky7bK0RhDHIcmaPJmuXJ8f7e9dlbUINtj4lXqMwuvnh3HNAyClBpv/Q6 YYay9q7jZVcC+MbEBdus7lD5f621WHbncTkIEa+l/w5kdLxA03k5qyk5r/QKoX9iSgjS hzAg== X-Gm-Message-State: AFqh2kp4DgAhC5f9kMGR6V8CQRhz9kxO/TtQg9vbYn8uOKGIB9W4yZ5h Pkms2SW1WyAa9GryxrRGtY/Iclf7ioHQJ21B X-Received: by 2002:a05:600c:13ca:b0:3d3:4427:dfbf with SMTP id e10-20020a05600c13ca00b003d34427dfbfmr45606329wmg.5.1673266148780; Mon, 09 Jan 2023 04:09:08 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id f19-20020a05600c155300b003d98a7aa12csm17583162wmg.16.2023.01.09.04.09.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Daniel Henrique Barboza , Bin Meng Subject: [PATCH v2 07/21] hw/riscv: Use generic DeviceState instead of PFlashCFI01 Date: Mon, 9 Jan 2023 13:08:19 +0100 Message-Id: <20230109120833.3330-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 Nothing here requires access to PFlashCFI01 internal fields: use the inherited generic DeviceState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Reviewed-by: Bin Meng Reviewed-by: Alistair Francis --- hw/riscv/virt.c | 9 +++++---- include/hw/riscv/virt.h | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index aa8db65685..a2cd174599 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -46,6 +46,7 @@ #include "sysemu/sysemu.h" #include "sysemu/kvm.h" #include "sysemu/tpm.h" +#include "hw/block/flash.h" #include "hw/pci/pci.h" #include "hw/pci-host/gpex.h" #include "hw/display/ramfb.h" @@ -106,7 +107,7 @@ static MemMapEntry virt_high_pcie_memmap; #define VIRT_FLASH_SECTOR_SIZE (256 * KiB) -static PFlashCFI01 *virt_flash_create1(RISCVVirtState *s, +static DeviceState *virt_flash_create1(RISCVVirtState *s, const char *name, const char *alias_prop_name) { @@ -130,7 +131,7 @@ static PFlashCFI01 *virt_flash_create1(RISCVVirtState *s, object_property_add_alias(OBJECT(s), alias_prop_name, OBJECT(dev), "drive"); - return PFLASH_CFI01(dev); + return dev; } static void virt_flash_create(RISCVVirtState *s) @@ -139,7 +140,7 @@ static void virt_flash_create(RISCVVirtState *s) s->flash[1] = virt_flash_create1(s, "virt.flash1", "pflash1"); } -static void virt_flash_map1(PFlashCFI01 *flash, +static void virt_flash_map1(DeviceState *flash, hwaddr base, hwaddr size, MemoryRegion *sysmem) { @@ -1514,7 +1515,7 @@ static void virt_machine_init(MachineState *machine) for (i = 0; i < ARRAY_SIZE(s->flash); i++) { /* Map legacy -drive if=pflash to machine properties */ - pflash_cfi01_legacy_drive(DEVICE(s->flash[i]), + pflash_cfi01_legacy_drive(s->flash[i], drive_get(IF_PFLASH, 0, i)); } virt_flash_map(s, system_memory); diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h index 3407c9e8dd..2be47547ac 100644 --- a/include/hw/riscv/virt.h +++ b/include/hw/riscv/virt.h @@ -21,7 +21,6 @@ #include "hw/riscv/riscv_hart.h" #include "hw/sysbus.h" -#include "hw/block/flash.h" #include "qom/object.h" #define VIRT_CPUS_MAX_BITS 9 @@ -49,7 +48,7 @@ struct RISCVVirtState { DeviceState *platform_bus_dev; RISCVHartArrayState soc[VIRT_SOCKETS_MAX]; DeviceState *irqchip[VIRT_SOCKETS_MAX]; - PFlashCFI01 *flash[2]; + DeviceState *flash[2]; FWCfgState *fw_cfg; int fdt_size; From patchwork Mon Jan 9 12:08:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640627 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2103701pvb; Mon, 9 Jan 2023 04:27:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfh6d3wCB35tGx828LG5rM2Rs4ic5Nvpm+lss3GgiANvh1beB6RbIhHlKlwZ87LsDjHdYT X-Received: by 2002:a05:6214:3808:b0:531:801d:8ee7 with SMTP id ns8-20020a056214380800b00531801d8ee7mr81141365qvb.18.1673267220857; Mon, 09 Jan 2023 04:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267220; cv=none; d=google.com; s=arc-20160816; b=ZdCCny1rMiUYgIAGPWYhJ5BhHCLkFy9VSHw0e3mJk1edoiVNdeuel6o99ngsju4GLM z1fpogAjS3536+iL9k1WHiSo5Ii1GQ9skCYMcOf2knQJE9jlADwBfZURSp40jvPTY/g+ 6Z7YysraowMNa14L5IekMfsrX2jD4QH4ZbWJEcoM91lxON+rxeLq3BPAypaVKY+QSOg8 0/bX9EZVQo9V5PlrAzqSR+xts6Vu4fsfIf/PUm0aSUx66tY2ZivRImOXh2hLoVMaTfHg WF0hNiwmBzasoeqwBRoxn9BWMcILTVRMW1ts5xXFXJHcAvzTm00LPmDM6ZXtFB7d/7Yw nvPg== 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=msNbVrY5Ck7M2M2GqYUu6XWKiG6PjDQ57JW5BgILQCE=; b=ipMj3o+lszofAxlxS+JgFyk7eRBiL/iSlnftN6I02/XP0MzGr00gK7CG0/HfU+GkAN 6Pk4/VE/+BCZ2zXJNUea0oVXU7ZJNRZSsAgbVvpi8zgpjEbmMCHNpqAKEpAPOL2mLczL KBOXPjnFlICLNiJLTQWts1m8+DuJO6aOncLgnbrTWBhngX+ZMdW7EKdVY35okrB5SEIo iNuPpbuvGs4k/2eIL9YvHODMkz42N4OFxB3QNmLZRYyeKgcWeTZZSxPM0Pfd2wYyrDXi aA9c0h1+Z7PBo9kwQcOQFoYwr32dwNHcMCe0jscmpJJPQTod4UCGIVJDQg9qXQCueW+f gUag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OS072Hex; 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 iv1-20020ad45ce1000000b004e467237b6dsi4659447qvb.40.2023.01.09.04.27.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:27: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=OS072Hex; 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 1pEqxv-0000BJ-RC; Mon, 09 Jan 2023 07:09: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 1pEqxu-0000Aj-6j for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:22 -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 1pEqxs-00060U-4V for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:21 -0500 Received: by mail-wr1-x42c.google.com with SMTP id t5so3514628wrq.1 for ; Mon, 09 Jan 2023 04:09:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=msNbVrY5Ck7M2M2GqYUu6XWKiG6PjDQ57JW5BgILQCE=; b=OS072HexoXTpyY7zA3ANAPfTWvtKrvA4WxUArtaRd9meeb1cpP7HPVucsuVNGkVaEW zYd9pLVyIMTHW2fABo7kT+xJe+6Ls2Pd068P7vHzi+IrPcgIWyb12QYrOqRQpJl5FOk/ CAe2+gWzvJiOfmrWctfcO/2gJN5HICpwc1Ye2EMzb9UIMtvcdefA527OQqZ5jj32QIC+ WpKyWvIT22AsEox9FnRQB6dYrT029mn1Or4sMOBXhpRwecu274b/umsJy8Ber0KSYryN 9YPrCxK35NjbH2uO/OrJVViURz8otPp55fWjnfAzhMElbsx/F9tFREK9rkOR5mkJZxcl Ywfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=msNbVrY5Ck7M2M2GqYUu6XWKiG6PjDQ57JW5BgILQCE=; b=CfxAoaM23u7KHYiWPskJRHn7Zf0rdZyiTEY5AHnutRiuVVX7HNFbrAkoNysMDhGhav ++kJ/L5n9j468I1jvernKDOT91XZNwNfGS5TLlg4EkUwbn6Geyu+6uNJSjUWYC9pISc4 9mLqXgS2Ji6RqH6SIpry64eCVSG0gJzwR99qss4fh+iV0W84AxEebi5LSNE9ScK8w/Q1 gKHpyDEJP0RosaCcw5DgJTdhry5ipMumhMaiPbNgtEo8bZqOOgft6ylc7JdyKtGNERWZ YiOJUZjgjrneJrq3AGjhq7djSf65lrO4rlgqIBbgayxxH9tm4PRotd3gS/8AtWa+DnvT UWKA== X-Gm-Message-State: AFqh2kqNSXOIS3S72L6rpE8cZlziUX1zwIBEiYS6ysGW31woSXuG1Abt ZRxpM8vQ5LQd7+pGqEZU2Whft7BP+lcq4kzG X-Received: by 2002:a05:6000:4088:b0:2bb:e896:5a09 with SMTP id da8-20020a056000408800b002bbe8965a09mr3577725wrb.66.1673266153523; Mon, 09 Jan 2023 04:09:13 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id k2-20020a5d5182000000b00236545edc91sm8511680wrv.76.2023.01.09.04.09.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 08/21] hw/i386: Use generic DeviceState instead of PFlashCFI01 Date: Mon, 9 Jan 2023 13:08:20 +0100 Message-Id: <20230109120833.3330-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 Nothing here requires access to PFlashCFI01 internal fields: use the inherited generic DeviceState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/i386/pc_sysfw.c | 14 +++++++------- include/hw/i386/pc.h | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 60db0efb41..1a12207dd1 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -71,7 +71,7 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory, memory_region_set_readonly(isa_bios, true); } -static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, +static DeviceState *pc_pflash_create(PCMachineState *pcms, const char *name, const char *alias_prop_name) { @@ -88,7 +88,7 @@ static PFlashCFI01 *pc_pflash_create(PCMachineState *pcms, * will be removed with object_unparent. */ object_unref(OBJECT(dev)); - return PFLASH_CFI01(dev); + return dev; } void pc_system_flash_create(PCMachineState *pcms) @@ -143,7 +143,7 @@ static void pc_system_flash_map(PCMachineState *pcms, int i; BlockBackend *blk; int64_t size; - PFlashCFI01 *system_flash; + DeviceState *system_flash; MemoryRegion *flash_mem; void *flash_ptr; int flash_size; @@ -152,7 +152,7 @@ static void pc_system_flash_map(PCMachineState *pcms, for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { system_flash = pcms->flash[i]; - blk = pflash_cfi01_get_blk(DEVICE(system_flash)); + blk = pflash_cfi01_get_blk(system_flash); if (!blk) { break; } @@ -187,7 +187,7 @@ static void pc_system_flash_map(PCMachineState *pcms, 0x100000000ULL - total_size); if (i == 0) { - flash_mem = pflash_cfi01_get_memory(DEVICE(system_flash)); + flash_mem = pflash_cfi01_get_memory(system_flash); pc_isa_bios_init(rom_memory, flash_mem, size); /* Encrypt the pflash boot ROM */ @@ -214,9 +214,9 @@ void pc_system_firmware_init(PCMachineState *pcms, /* Map legacy -drive if=pflash to machine properties */ for (i = 0; i < ARRAY_SIZE(pcms->flash); i++) { - pflash_cfi01_legacy_drive(DEVICE(pcms->flash[i]), + pflash_cfi01_legacy_drive(pcms->flash[i], drive_get(IF_PFLASH, 0, i)); - pflash_blk[i] = pflash_cfi01_get_blk(DEVICE(pcms->flash[i])); + pflash_blk[i] = pflash_cfi01_get_blk(pcms->flash[i]); } /* Reject gaps */ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 991f905f5d..70abe61805 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -6,7 +6,6 @@ #include "qemu/uuid.h" #include "hw/boards.h" #include "hw/block/fdc.h" -#include "hw/block/flash.h" #include "hw/i386/x86.h" #include "hw/acpi/acpi_dev_interface.h" @@ -35,7 +34,7 @@ typedef struct PCMachineState { /* Pointers to devices and objects: */ PCIBus *bus; I2CBus *smbus; - PFlashCFI01 *flash[2]; + DeviceState *flash[2]; ISADevice *pcspk; DeviceState *iommu; From patchwork Mon Jan 9 12:08:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640631 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2104996pvb; Mon, 9 Jan 2023 04:30:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXuOj7M+9wBcT5ONucW3X59v9RFUKkbRQb8aG0TmWB1Qu8EfpSmy7WHtjLUsCMoxpCUL9KGL X-Received: by 2002:ac8:4d42:0:b0:3a8:5d1:aaca with SMTP id x2-20020ac84d42000000b003a805d1aacamr82558640qtv.11.1673267411689; Mon, 09 Jan 2023 04:30:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267411; cv=none; d=google.com; s=arc-20160816; b=SQl44VNQKCXvwJ7rvCDqGni6UmwfxCaLEGD78B0X5fD/nfeU2+SvfijqAs9Cl1Irdn ewXv/w1+LklwFP5dv5mtunEG/x/GmpdDJJzZ7CiK9p61coFYEriEEmQD4YEdu8fbcAT8 DR+2K0YB3dHVKvH6OvfOpqNTU0x6vC/e4KRVQqxvTJwRuGqCYcpTJmIiNYKF6uwdHSF8 d89X5ZEPan22okiTSy9uc5PBRwFpBZbAx/5IwTXzmwqTQvXWx3G2OTRjB0HboXflZsDi 8KSyYDkZ7NINas9iUK3CStS21YJVhYCnDiyZHIMDnRiFhVdAs+QSJNcC1eCFxL8XCNSt 3foA== 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=nfl9vSICdKM0NyWoDAVGk3SRqJjMJWSIIowMTStBvnw=; b=lDexHgt/G4rDUdJ5kOopqgFqO8H2sCCB8ASrUOF7uxQp5PAMnMmsOh1NxjyvbjKEYw +U1qAwfXVYD3B95Ww4Z7qdYmXCAU6rbQWV813WBiozUQo0hg9GfSQQ34XgTB7+K34u/r 0fVhaRU4ASATbOhZYWShsGdcfII+byqDh8L4eYFTyreeWyF4vRfRzUR08QUJoAKII16t 5zmBs9ffJoHt5MNTMpW/yOYAnkaDDY708gywEmibEzxMPv9seClcsMPbtsR49q2u1vl3 M7NOoEWG2P3DEM4/SLoz4+h+okTWGPQmYJEybmGXJ7aZF53Qq/WpcT/QX2YzSg3xHoOr sOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="om2W/3DD"; 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 bn11-20020a05622a1dcb00b003ab93dd883fsi4524339qtb.243.2023.01.09.04.30.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:30: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="om2W/3DD"; 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 1pEqxw-0000Ba-EB; Mon, 09 Jan 2023 07:09:24 -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 1pEqxv-0000B9-99 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:23 -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 1pEqxs-00061W-5l for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:23 -0500 Received: by mail-wm1-x32a.google.com with SMTP id p1-20020a05600c1d8100b003d8c9b191e0so6508757wms.4 for ; Mon, 09 Jan 2023 04:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nfl9vSICdKM0NyWoDAVGk3SRqJjMJWSIIowMTStBvnw=; b=om2W/3DDStD8FxqLQespwo5dTpdpCesXi31T0xbE9BOX12rQOPigt4M+75N/gV6++i yjp6Cv9osl6uhgz/oF3VyxG6T+gPv07+mnQan951HGHSrqVlYqHF0G4acdQgJGQdndDU SfNwI9xNx/lWo1yvzI5HADM7FjCwcspqg52/4sIunGur9QI3STX0nGONGHgZy1NzN/nf QPzlYkasVt72u2kIiiM/qCAJvquEdzK5KiU9VUMPq+IdSCQPzDixVPT0kkm4Wa/lvzlK 9/CCp4ba6InAHzN1oBmJ28wmgf4Q77YJPSvTNy/tq1dRW+SJMO3QnphKrxYCpZScC1kX C58Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nfl9vSICdKM0NyWoDAVGk3SRqJjMJWSIIowMTStBvnw=; b=jC5z29G4k9ofb6atSjA+6T/n34AUHnOAU3+SchNkQBTfVLOldp+PWJTfdveBFWX+A5 m6vXEVGD7D59eTWdmGWGPS0GVTm2cAuH9us0+J+HVZUC8PgGuuEjr+rPC2s4GvoylZ9e AuCHmWapVmYHN3ib0+TVbIttY1FuyhcIWXurrSrlJJcwfL/J5YpD6NoRdWt9IcdthKzG 9unHc94R8EmGE5HC/BNHm1EFeRjiqRVt7geTwj9QAQHZ4XfaxW6lUIf2Mu0HvpwpYSN5 lF70W5eHFSZgvQCugmakJ2P7sVrUgyyaHTYtlz0lbMPNq49QcmSALkEbiguVGOahJV97 ns9w== X-Gm-Message-State: AFqh2krcuGNog0R73WQ4uCpzRpVcDtMBIx/Gl+rJps5A1fbprgFQNeGa 7TPnpWMHTl6m2tDxVjRcHLffzYsSyWHenH19 X-Received: by 2002:a05:600c:4b1b:b0:3d2:1d51:2477 with SMTP id i27-20020a05600c4b1b00b003d21d512477mr56304360wmp.11.1673266158265; Mon, 09 Jan 2023 04:09:18 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id h15-20020a5d548f000000b002425dc49024sm8343577wrv.43.2023.01.09.04.09.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:17 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 09/21] hw/xtensa: Use generic DeviceState instead of PFlashCFI01 Date: Mon, 9 Jan 2023 13:08:21 +0100 Message-Id: <20230109120833.3330-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 Nothing here requires access to PFlashCFI01 internal fields: use the inherited generic DeviceState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/xtensa/xtfpga.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index bce3a543b0..b039416fde 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -165,7 +165,7 @@ static void xtfpga_net_init(MemoryRegion *address_space, memory_region_add_subregion(address_space, buffers, ram); } -static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space, +static DeviceState *xtfpga_flash_init(MemoryRegion *address_space, const XtfpgaBoardDesc *board, DriveInfo *dinfo, int be) { @@ -183,7 +183,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space, sysbus_realize_and_unref(s, &error_fatal); memory_region_add_subregion(address_space, board->flash->base, sysbus_mmio_get_region(s, 0)); - return PFLASH_CFI01(dev); + return dev; } static uint64_t translate_phys_addr(void *opaque, uint64_t addr) @@ -231,7 +231,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) XtensaMxPic *mx_pic = NULL; qemu_irq *extints; DriveInfo *dinfo; - PFlashCFI01 *flash = NULL; + DeviceState *flash = NULL; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *dtb_filename = machine->dtb; @@ -459,7 +459,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) } } else { if (flash) { - MemoryRegion *flash_mr = pflash_cfi01_get_memory(DEVICE(flash)); + MemoryRegion *flash_mr = pflash_cfi01_get_memory(flash); MemoryRegion *flash_io = g_malloc(sizeof(*flash_io)); uint32_t size = env->config->sysrom.location[0].size; From patchwork Mon Jan 9 12:08:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640622 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2101842pvb; Mon, 9 Jan 2023 04:22:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXstrjZmn/MaXmb/UR9hlc6qOmS2ZRJzfJCQfMpCxRsP9236qzUAk5WlTXnhS/mpe/ERBddx X-Received: by 2002:a05:6214:5c02:b0:4c7:b0f:6759 with SMTP id ly2-20020a0562145c0200b004c70b0f6759mr88115537qvb.8.1673266940868; Mon, 09 Jan 2023 04:22:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266940; cv=none; d=google.com; s=arc-20160816; b=NlaHhTpVdhpqbMj/O5xTKADkqHapPMPjvUtRNd5c7FmXkPT7svvBIsxuV4uavn4sfx XAfLmN734sJrrLLfAz38coZ/2e4liVAS35HtfcrEkYy7tkzdfeLvDfIQTL9xOYmFqhNy UeSV14Y3Cdmn+DJsd0JZvX4zdfVyW/sRhASvTf5nqDfxEz9Rt1qZDF6t9mYDu/f9ixb/ nnKw430ey0W3Y2jhbpReYLyaLnz5maCdbFT+24/ZOkc0XaW0rk1zxAI22z4d9ieZ3ZX5 FbqIMJGXpI90wSPDXEAgeAyv6x96JhDe486pdyGvwniBaIHhsRBxA72hDwbIyO0JlC44 PrJA== 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=aFd+wtyzXvHOeirlkajEST4RkXpF4SUSar3CLCCFjSo=; b=x5YVChCCwYhUPcyCGakpUzQHNJ2ygU+vbxSCUowhVKgQ6Pugn3YgScjWxqyO92DdpN gS00/Govx0bviaEO6gKC3uUtOiJ3PwtI26p6WB3bwZMLFWkhT1P+iRBz/whUnV5XSgxs 4d7XJeiKnXy+Mt6JXs9VBgmd1Q0o/IaV3/Ni5b4elpJ+gmlx1NGhFjXw9YSioJfkwkQv Xc1JMofe27NeBILITemuam5hEKCwipAVhpltvBHHnELJ7MzAxZM2YXuK+qnsGLxqoKG7 Dxo0rqKbDh4w/lKyYv7auSMQFubvDL73n5JhqgnYofx9TZvxTiL+9TtufUUjXyLDR9dg QRCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="B/VBGUBB"; 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 fw5-20020a056214238500b004c6e7ceb679si4462119qvb.443.2023.01.09.04.22.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:22: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="B/VBGUBB"; 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 1pEqxz-0000Ce-2R; Mon, 09 Jan 2023 07:09: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 1pEqxx-0000Br-DM for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:25 -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 1pEqxv-0005wv-Re for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:25 -0500 Received: by mail-wr1-x433.google.com with SMTP id bn26so7957833wrb.0 for ; Mon, 09 Jan 2023 04:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aFd+wtyzXvHOeirlkajEST4RkXpF4SUSar3CLCCFjSo=; b=B/VBGUBBgglIotjkVDDiVq/pTTeQ4vKdc5vNNlPZFt10XpkNQ5aN5fs0Z3+z3gHjxe UAscrZY/sf8P79IteY6WQu8+jnior4hy2rKRA3EYJC2jd+rU8msU+XbmOh79aMYJX/2j DXsTF+UiIxwucttqKFF991WBWmGkJT3Axnss0IlDav6rB89Kpnf97HRVBw4c1ReOzX34 dSAsqkbYoy51zYKFy70w80LU9CrQJkg+Y13IY7Xuw77GOqidWkGNaNB0toFUklrBpxDB sLogBHah89EVH78t5m8hH9uhpSrdJNdabqTv1XP2vW8VQGFORFMtqgZyELIs3siAauib JStQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aFd+wtyzXvHOeirlkajEST4RkXpF4SUSar3CLCCFjSo=; b=j0fbc63BlMW6OkEQKDLdu/H3KKYFenA7lg8zE0kcaMBHjjHsYXjcX+vaWimJdavAg4 g+37MLdhMASjQxKeMPeFHc7ReBnkzQDEfNLNRrFK2Mt1ll78/DcBVpLaygKTIBCY/OOK lDQ4Z80RlyNbHS7p63myARqmYPaX8AaqKETxVK/N+tfo+xzUNrYSS7glxj/gU4ea38ES 2sUcsKM538YSf4gvUMLXtWTwmU+0AhfeR6s0Bo3eF10IrtvbAndS5EKvSReyt2KFSbks PWmrTuaLXhEDHXNBJpBbP2vWAIfv9aftEm7P3TC+NgEPpcznIQ5NjpHLF8dpAi/7LJca xqVw== X-Gm-Message-State: AFqh2kofhK+tVfC7K5jVZlXLFGI+13/OewmRfTYPNAu5kyrUZU8iXr/Z 5ZJ374X0wTyxEz1JSqsYnfW8J14pxRKUqJKd X-Received: by 2002:a5d:5045:0:b0:27b:b974:2c01 with SMTP id h5-20020a5d5045000000b0027bb9742c01mr34284586wrt.71.1673266162926; Mon, 09 Jan 2023 04:09:22 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id d16-20020a5d5390000000b00281b594c725sm8310518wrv.38.2023.01.09.04.09.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:22 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 10/21] hw/sh4: Open-code pflash_cfi02_register() Date: Mon, 9 Jan 2023 13:08:22 +0100 Message-Id: <20230109120833.3330-11-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 pflash_cfi02_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi02_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: BALATON Zoltan --- hw/sh4/r2d.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 6e0c65124a..9d31fad807 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -303,10 +303,23 @@ static void r2d_init(MachineState *machine) * addressable in words of 16bit. */ dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi02_register(0x0, "r2d.flash", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 1, 2, - 0x0001, 0x227e, 0x2220, 0x2200, 0x555, 0x2aa, 0); + dev = qdev_new(TYPE_PFLASH_CFI02); + qdev_prop_set_string(dev, "name", "r2d.flash"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint32(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "device-width", 2); + qdev_prop_set_uint8(dev, "mappings", 1); + qdev_prop_set_uint8(dev, "big-endian", false); + qdev_prop_set_uint16(dev, "id0", 0x0001); + qdev_prop_set_uint16(dev, "id1", 0x227e); + qdev_prop_set_uint16(dev, "id2", 0x2220); + qdev_prop_set_uint16(dev, "id3", 0x2200); + qdev_prop_set_uint16(dev, "unlock-addr0", 0x555); + qdev_prop_set_uint16(dev, "unlock-addr1", 0x2aa); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x00000000); /* NIC: rtl8139 on-board, and 2 slots. */ for (i = 0; i < nb_nics; i++) From patchwork Mon Jan 9 12:08:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640634 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2105494pvb; Mon, 9 Jan 2023 04:31:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXvzRer3F2tcojQmf5RtLgdenKMaQREeNuMTtwoVo/yhS/MB4ax+n8psf9+156IWUKkQ8qrL X-Received: by 2002:a1f:9110:0:b0:3c7:eefd:c8ba with SMTP id t16-20020a1f9110000000b003c7eefdc8bamr28053639vkd.5.1673267474540; Mon, 09 Jan 2023 04:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267474; cv=none; d=google.com; s=arc-20160816; b=Rj5ag74Hyk9yVR3YpjTX2wNu1VUAbZZXiC1gmkxtjDQDpVFius22apgvkoCvjsJWa3 HYeGXK3HjOasiT1j0b827urTg97K5FD5sDGqy/fO3ZwebbOz6JW1+b65dpATaL0KD9ha NmsJ/8q2aSLRSUNiPBSQPDceyK/NdmON6ARc7I4g8lkYsxDTI4Jxnlseg08Qz1b181VF iLK6sAD2FwYW133XBwcgRPcHDSO44TfsgUkXAxxtERT1OZL38ZHZdLEP9G0Cmln4DfQM wcJA0PLAoyFSpFgt0G8jzPXSVATwuUlN+1E7nMGXhJGsHBh+HAVjthmaQ+9vKCLQMnwj KaIw== 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=6JVm2lTb7UkwzLxpZjEdvuXtpe4YgD9c58GS9MDcMYw=; b=eF59EKM/oAoR6E2rVXQ5eUhOIcqU3MocObQvQruQnhCVWBGAfwJ6yOElceO4tUklXG ZgfQYPyveOU1z9sY4QjKTmmYEG8mlP8qofI9Lmg2qnLzMbVLv/FBMosvTMTsIbZUMRhX OcRgea3zGen49ZZI8IHf+BFDU0HOP7jKbz/3AiMrwlPsFZ32ynkrCkhFFBAy8dALnhiq 4Z/n3NYw7NsYIoypI01gmm4N2KItb2Ph5oHnURw3XqfcSqc0y739oZ21ZVVmhamgfCeL G2CKFOpKc8sJZF+4uFqboKAvW4F5IWRcQb5aq4lfcAsF7wevaS1KjdaiNyCWVkc4FuSe yASA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zPEvnJz4; 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 m15-20020a05620a24cf00b0070525de74dasi4678183qkn.556.2023.01.09.04.31.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:31: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=zPEvnJz4; 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 1pEqy9-0000EZ-1B; Mon, 09 Jan 2023 07:09:37 -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 1pEqy3-0000Da-2K for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:31 -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 1pEqy1-00064K-4o for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:30 -0500 Received: by mail-wm1-x331.google.com with SMTP id ay12-20020a05600c1e0c00b003d9ea12bafcso3425462wmb.3 for ; Mon, 09 Jan 2023 04:09:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6JVm2lTb7UkwzLxpZjEdvuXtpe4YgD9c58GS9MDcMYw=; b=zPEvnJz4fgEn6Rh42rnJtmC2mAB6mwl46P29XRL2dHM9o8WEwjkgHnVZH4rrxRH9cz c8Nsb2cSWFG1j8aCAVKd+j6IgGQASat5OY29rtcAr0t9U25qYE5V01KvCid+FlgC/ctD pIp1sF3BmdRupa58fC3dfAu+UtWvoe1EVkxxlMgmps8+mDrC7e9yLTssNMs86yDC5giy Qjj4M8AtyfN1bReD+CfG1D1ouN2WOnkKw+CxQAmbdq7xuOgjjU3AYCyNHFMPeHxoZKbP PhRmJnblFvvdxJdUHS76+WhaL/oWV0+R15U4UI5P6nJ8BnfHXoQ0vn/U3G5cleNnvfMh PgrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6JVm2lTb7UkwzLxpZjEdvuXtpe4YgD9c58GS9MDcMYw=; b=22ijddrG7+Sv0dqauSfTAkqiBr538H5I9GBJAEsTMUGS2P5B3usIvFpb2chXgbq0FR uMjsmbev1FNO0K1pRde6GDf6AzvO50BpOZYDHQKTP7m/1lQpAz9OqaE5G50/EjgSd/YC 04oaOt/XcW1bri4kfSXNmGbw89WnkhBEDCbbtWkAQ8BoBOzvN/v1s6kG/tC0647RuabC 911Tjh6zgcK23If9C20EfsaugjCnyGbKSWmFeqinFZ/JmJNPVxLs+PzsHXSkcdoc4bmV BEzAjkcrPsBn0T7QZ6AEVcilCP+/l5GmyZ3uYTwhuHWRqrhAGKaC2eLu86JvbUXsmuGU elzA== X-Gm-Message-State: AFqh2kowPA0IQDn+x2ZMYhcjc3T0kYw7DpDvnADad1H0/DfaKKj3nNAw Jh3B2e8/ueh13Y09n16Y5ybO3GYM96ltFlhS X-Received: by 2002:a05:600c:54c6:b0:3d3:4ead:bb07 with SMTP id iw6-20020a05600c54c600b003d34eadbb07mr45790869wmb.5.1673266167591; Mon, 09 Jan 2023 04:09:27 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id i14-20020a05600c354e00b003d1d5a83b2esm17308377wmq.35.2023.01.09.04.09.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 11/21] hw/arm/digic: Open-code pflash_cfi02_register() Date: Mon, 9 Jan 2023 13:08:23 +0100 Message-Id: <20230109120833.3330-12-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 pflash_cfi02_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi02_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- hw/arm/digic_boards.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c index 4093af09cb..3700f05ecc 100644 --- a/hw/arm/digic_boards.c +++ b/hw/arm/digic_boards.c @@ -30,6 +30,7 @@ #include "qemu/error-report.h" #include "hw/arm/digic.h" #include "hw/block/flash.h" +#include "hw/qdev-properties.h" #include "hw/loader.h" #include "sysemu/qtest.h" #include "qemu/units.h" @@ -115,13 +116,26 @@ static void digic4_add_k8p3215uqb_rom(DigicState *s, hwaddr addr, { #define FLASH_K8P3215UQB_SIZE (4 * 1024 * 1024) #define FLASH_K8P3215UQB_SECTOR_SIZE (64 * 1024) + DeviceState *dev; - pflash_cfi02_register(addr, "pflash", FLASH_K8P3215UQB_SIZE, - NULL, FLASH_K8P3215UQB_SECTOR_SIZE, - DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE, - 4, - 0x00EC, 0x007E, 0x0003, 0x0001, - 0x0555, 0x2aa, 0); + dev = qdev_new(TYPE_PFLASH_CFI02); + qdev_prop_set_string(dev, "name", "pflash"); + qdev_prop_set_drive(dev, "drive", NULL); + qdev_prop_set_uint32(dev, "num-blocks", + FLASH_K8P3215UQB_SIZE / FLASH_K8P3215UQB_SECTOR_SIZE); + qdev_prop_set_uint32(dev, "sector-length", FLASH_K8P3215UQB_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "device-width", + DIGIC4_ROM_MAX_SIZE / FLASH_K8P3215UQB_SIZE); + qdev_prop_set_uint8(dev, "mappings", 4); + qdev_prop_set_uint8(dev, "big-endian", false); + qdev_prop_set_uint16(dev, "id0", 0x00ec); + qdev_prop_set_uint16(dev, "id1", 0x007e); + qdev_prop_set_uint16(dev, "id2", 0x0003); + qdev_prop_set_uint16(dev, "id3", 0x0001); + qdev_prop_set_uint16(dev, "unlock-addr0", 0x555); + qdev_prop_set_uint16(dev, "unlock-addr1", 0x2aa); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr); digic_load_rom(s, addr, FLASH_K8P3215UQB_SIZE, filename); } From patchwork Mon Jan 9 12:08:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640642 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2116770pvb; Mon, 9 Jan 2023 04:56:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXus9tuHvBr5esOZjllj/+32Lb6aTGomw2TI7lS3NampCIWpE/XLdVsf7PcuSMoH5dq1T1PH X-Received: by 2002:a1f:de87:0:b0:3d5:7838:1f30 with SMTP id v129-20020a1fde87000000b003d578381f30mr20857291vkg.14.1673269013862; Mon, 09 Jan 2023 04:56:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673269013; cv=none; d=google.com; s=arc-20160816; b=yaMJ7SHMWmGao/6rN9oKzLUNegkIRcspdA5UEY4NRCHEN281eoQn0QrLHxiFsTP3hD K+9dQjPuAAHTh+bW3py71gcUK+e0OIVY07n066a1tu+P8kyaQMzPHeK3OdU/UgB8VT/P 3Xcy7Bdv3f9679wTOsZhXzBfWryYtoxg8+PVHas9f8+BYFG4x4/k+nX/X53MqOdNyjtf XBDvrzj2aIzPH+/ESLVKehmr2Scn0VVKMXxolbl7AYpnpNNxDOqHoEBxFTHMPjiNzCk/ wE+oJDQJorMzGv4E8y8ToaQ3MEI/yHioFJiUcYCrgQP3gN33ZWmxHxFF/fwjz9bL3K8q R9BA== 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=iXP1F7lSakDxBjs/lpI6jI9ho7Qb2JPzan4/9u1RAoM=; b=m9eYuqAncP2cyAhy9ySUe1lKl+k06ponZk9RI5yl4J9F561ebkcCS82jiwtehZRwzA NtSgLQ55y80FQquh51GKswrQGcFW5Xt0I9c8afeP94Q9B+f5fgOdaXB7OUbEKY3r1Z5d ljZ3GsNnITqqZ82aeEHm83G177L7nbY5CHD6mmASDjZSuZQhi89wZrBzZiL5vdBpCTMw WikC4cko+nZZ8CRH7pQgjwnb3vLpO1ucKfMPYQfO7Vq4DyOxojG4A78STSR70v5bFCbY hfSRK5u/w4gRxl0EjA6Ht/LQa4NXVm1rTFa/oCEtb2rglGOsnt2B4h5Dn7BXv1j9kyyh xN/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tJJnj7We; 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 os35-20020a05620a812300b007050f63d946si4068869qkn.716.2023.01.09.04.56.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:56: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=tJJnj7We; 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 1pEqyA-0000Ff-J3; Mon, 09 Jan 2023 07:09: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 1pEqy8-0000FF-GL for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:36 -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 1pEqy5-00065p-RL for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:35 -0500 Received: by mail-wm1-x32b.google.com with SMTP id j16-20020a05600c1c1000b003d9ef8c274bso2156944wms.0 for ; Mon, 09 Jan 2023 04:09:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iXP1F7lSakDxBjs/lpI6jI9ho7Qb2JPzan4/9u1RAoM=; b=tJJnj7We1DXEUx6PXgyaHglsKQLNF5WCK/hHjEr1JYDcQfZ7qlzaF/ieeqEI+29u9q CRwcIT9h+TN+ty5MVW1O1W6kA/PMpzmhv7SB4lrhn5Qi6lgPTQ2g/anbmwbQvmDUClFZ X66Lu5GANnBt/edUrzWTvpFK64PcT/LbJJei3cbQwTqxh0t8y31WhhsmCEcVYOwAet0q fjf5SYmySxOIB/UalenF7wbiWeqzK6UHW94FzSDlYTPMyd2U/GqTziC/aDT7W2L7ShKj f+nBHFvr6ErADL4hLdK3CFauCmRMpdarhYmckLZw86zVKHvj6DJxyzAh3MwUrDj5NWNx aFPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iXP1F7lSakDxBjs/lpI6jI9ho7Qb2JPzan4/9u1RAoM=; b=Jo7DwYfQehdeZrjQ56nfSVQ4V/92UpejEwM05/P+gjdvy6KvRtN0oIarvK/uc0Rzai dLjZNxuGtLhSTxDNxQ5Bu2yepMRzTzyj2hxxTC2QF3YdcDR2xDl/88NtIqjnjNjzBwuh sXPeeXGuV2woaY7VZY1lsJCnqqI5ObKlQLOr4Tj+MvZjKPaI3hoWgbp9hgsQG/mK9pOk jBvbygjCz74YPcIMHLoWcxz5kzr6BOLQondi01BidiToRlXHI/t9d0k7GDZcL0YZbwV1 TUlr4nXsQtKCnpQ7me8F/x9XE83xT6U+MqEWH9QBZc70wzt8LGmQtiXEAVAuqMeQbMIX gphg== X-Gm-Message-State: AFqh2kqUHKsNq/x1UJszP92/bFat1CxHUwmNy0TAYzBnOw2qQ4eT72Gt ZmxbpkKx9UDA7kayRtzFkqUqN4HNnRi9FdfX X-Received: by 2002:a05:600c:a13:b0:3d0:2485:c046 with SMTP id z19-20020a05600c0a1300b003d02485c046mr45569859wmp.27.1673266172325; Mon, 09 Jan 2023 04:09:32 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t10-20020a5d534a000000b00272c0767b4asm8393000wrv.109.2023.01.09.04.09.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:31 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 12/21] hw/arm/musicpal: Open-code pflash_cfi02_register() Date: Mon, 9 Jan 2023 13:08:24 +0100 Message-Id: <20230109120833.3330-13-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 pflash_cfi02_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi02_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- hw/arm/musicpal.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 73e2b7e4ce..b5f2b9d9de 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -1278,12 +1278,21 @@ static void musicpal_init(MachineState *machine) * 0xFF800000 (if there is 8 MB flash). So remap flash access if the * image is smaller than 32 MB. */ - pflash_cfi02_register(0x100000000ULL - MP_FLASH_SIZE_MAX, - "musicpal.flash", flash_size, - blk, FLASH_SECTOR_SIZE, - MP_FLASH_SIZE_MAX / flash_size, - 2, 0x00BF, 0x236D, 0x0000, 0x0000, - 0x5555, 0x2AAA, 0); + dev = qdev_new(TYPE_PFLASH_CFI02); + qdev_prop_set_string(dev, "name", "musicpal.flash"); + qdev_prop_set_drive(dev, "drive", blk); + qdev_prop_set_uint32(dev, "num-blocks", flash_size / FLASH_SECTOR_SIZE); + qdev_prop_set_uint32(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "device-width", 2); + qdev_prop_set_uint8(dev, "mappings", MP_FLASH_SIZE_MAX / flash_size); + qdev_prop_set_uint8(dev, "big-endian", false); + qdev_prop_set_uint16(dev, "id0", 0x00bf); + qdev_prop_set_uint16(dev, "id1", 0x236d); + qdev_prop_set_uint16(dev, "unlock-addr0", 0x5555); + qdev_prop_set_uint16(dev, "unlock-addr1", 0x2aaa); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, + 0x100000000ULL - MP_FLASH_SIZE_MAX); } sysbus_create_simple(TYPE_MV88W8618_FLASHCFG, MP_FLASHCFG_BASE, NULL); From patchwork Mon Jan 9 12:08:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640619 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2100986pvb; Mon, 9 Jan 2023 04:20:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXsZ+IEtaZ9UocivEvioROmnjtSPNCdzLje9HJu5pKhlbJF+7qR+VTyATLkQ7OlewCKfzHz/ X-Received: by 2002:a1f:19ca:0:b0:3d0:f9d5:637f with SMTP id 193-20020a1f19ca000000b003d0f9d5637fmr30825829vkz.0.1673266816313; Mon, 09 Jan 2023 04:20:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266816; cv=none; d=google.com; s=arc-20160816; b=zDsUy+2QtEqG5hF8iVm8o7IlKep+ORTIqOrctMfzSAx3F/qtcAvgG0z22orygAGg8p RfUKNSGhQkq9wcHkY+/EMZbTgv4MUkiz1my8Gxczo53Gf1f37bAWGgcliM6HfzfXoaEr vfhDQmqkVuUnd26XrxTtDJRpEMfFRVw+9ZIbhPuUOE6bKCyRTyE18KXkTk+bJDewUG6+ W9FzLSxAaOSoSbOmooYuxmaP3ArUYYnqWNmxHVDW63mLMBGAiYB20RqfkGnY0xNGEE4r JQUX0gg+c9BjemFB46JaF1vWOqh5EiKCASg+ZrJFbe0qoCtzJlMLRMblGY9c/ByPLY5c //XQ== 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=WfePbK//n9RdGQ4Q7SWyXOJeAcbh03cN6S/LGxgtM7E=; b=HBof8+mq/0s4HFE7I6lXNfKqviWVFK6FeiFtZx7IWKUQDqJED4qomxNOHv4AVl+yze v3pTWUuYFZCvKyzM1v9qZN++y4jwUwAakAEURRTH2NreP/GnH5zmJBbOg+ikwbmnQKfc zEVSuXMZ52+eSApbVAcqHiYoWGn6zTVrNjknXCiooP9qti8JVPVunmQ1FESUX51/UUtO TfEraVbrn/PeGgRiQpjbhpEXqixQ+5B09QatnnHDhZId10wd1upEfsCmkVXZUTh+Kqdt nUXgL5+mQwvdO+HmVj6BNMo/DCgVg03vjkMQZSHJNgthT/LWdGLJkXkzoKIE1ivr2YlC onKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GuWCr1AV; 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 s201-20020a3745d2000000b006fbf7a09e45si4221094qka.442.2023.01.09.04.20.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:20:16 -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=GuWCr1AV; 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 1pEqyG-0000Gq-Lf; Mon, 09 Jan 2023 07:09: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 1pEqyF-0000Gh-IU for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:43 -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 1pEqyD-00066t-RW for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:43 -0500 Received: by mail-wm1-x333.google.com with SMTP id o15so6089442wmr.4 for ; Mon, 09 Jan 2023 04:09:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WfePbK//n9RdGQ4Q7SWyXOJeAcbh03cN6S/LGxgtM7E=; b=GuWCr1AVAkll0FU0H+0+RQK9YBa3mtI3dd2d2cJUHABbzUhYVVlM3ELh8alCDy/i1h MkMT8WVkR8QTlXJYuYqCq11zRjpCc6szT+EnmzkUWp+IK6CA9U/FYp5gyUNF7gtvC94+ qCCtd8ginIsOk+Rw4wPdviThNO5MUK+XLekFiRUrvTQ9661wllZJoPldx3y9006JdH6Q Umj38ca8nAbm4JF8PaHhBhy5oQuqGy61qqUD/vbN/n5hhDzbhYiPCg8WTfBq9wRgN39M 9I2D01jiwJ6a/zGWRqS+WaNFi2ikj/sVVqwsgDNwf4b/4mEG6vSkTUwcdFc/0V2H0tdl yhBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WfePbK//n9RdGQ4Q7SWyXOJeAcbh03cN6S/LGxgtM7E=; b=o5fXXPJ/jB7YkWbQpaRwkGdWtQcsyV/sTZEpoeejUIF6K4K18fWIso7smu5Qk+yV3a EORakL+eADbZlbbB82nVOqUOnV8Lh4sD1NKlvAHtQao+R9PJ9kCqBrG2zpAivPJcrms/ lEq/Uzex+IwMCvaY6mvtDHRo167DoOnX1rSx7jtEw79LCECtJNjBvsaWdzNZK9FVu6wh BWkFJPIH0TTDlmSjg+s33I+pxLREsOVLHEdSTZdWVf2YUYJQERBnUvhLjq61uQlBQ0Fg xvFsdALEUYhk4nC0E8mOMHr7PNfQ3F/WJg0FHrWXJkMngfK1Sr2D6+BXSyjUXjRUQFPQ 1vDQ== X-Gm-Message-State: AFqh2kpAYpaKTxr22Wbh4QMN0NRgv5h/Yg2R0HkmOKA/XDCbDCBeKQAA Ty0+XUPFmnsCZEqAGC+RsUUDDoFyfxAC9Eug X-Received: by 2002:a05:600c:358e:b0:3d9:9755:d659 with SMTP id p14-20020a05600c358e00b003d99755d659mr28658708wmq.22.1673266176842; Mon, 09 Jan 2023 04:09:36 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id 16-20020a05600c22d000b003b4a699ce8esm14905808wmg.6.2023.01.09.04.09.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 13/21] hw/arm/xilinx_zynq: Open-code pflash_cfi02_register() Date: Mon, 9 Jan 2023 13:08:25 +0100 Message-Id: <20230109120833.3330-14-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 pflash_cfi02_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi02_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- hw/arm/xilinx_zynq.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 3190cc0b8d..201ca697ec 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -218,11 +218,21 @@ static void zynq_init(MachineState *machine) DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0); /* AMD */ - pflash_cfi02_register(0xe2000000, "zynq.pflash", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 1, - 1, 0x0066, 0x0022, 0x0000, 0x0000, 0x0555, 0x2aa, - 0); + dev = qdev_new(TYPE_PFLASH_CFI02); + qdev_prop_set_string(dev, "name", "zynq.pflash"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint32(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "device-width", 1); + qdev_prop_set_uint8(dev, "mappings", 1); + qdev_prop_set_uint8(dev, "big-endian", false); + qdev_prop_set_uint16(dev, "id0", 0x0066); + qdev_prop_set_uint16(dev, "id1", 0x0022); + qdev_prop_set_uint16(dev, "unlock-addr0", 0x555); + qdev_prop_set_uint16(dev, "unlock-addr1", 0x2aa); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0xe2000000); /* Create the main clock source, and feed slcr with it */ zynq_machine->ps_clk = CLOCK(object_new(TYPE_CLOCK)); From patchwork Mon Jan 9 12:08:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640630 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2104475pvb; Mon, 9 Jan 2023 04:28:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXsukSalZASIswGNDBioz00K5yNvFnfUC1Qbm/u4bFZAj5+lgb68+kWuFEt441KZ8UPzAagI X-Received: by 2002:a05:6214:2c20:b0:51f:6fd9:e5a with SMTP id lc32-20020a0562142c2000b0051f6fd90e5amr90515386qvb.39.1673267333354; Mon, 09 Jan 2023 04:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267333; cv=none; d=google.com; s=arc-20160816; b=TwrQ2bhat7pInOxU6pO43LIerKoQdR9WtYt5+8icAU7VVDmsOWZ9q8urKDfajLqaDx ZJ0xsuQ/R/p7wgt5okhsAcd6smmuGOmJKdvIvw6tOXiOh+kZPsyDjZ1PJyz60sOMM6Xw 5hPLGAH9FeFRQMvrnoxTPj2mneclsL9pTEs8jmkXSrUw23qDruy+EsU5lS3GLA4K/o4I odm0TUi4leqeS0GzlZOD2tokbyusPgzwbw230LMPIuRusb4lR4VMgEmIDkfiz4njo0ZQ JPkQCOMb1NuGky1vFPgHVJ3CoLNQ4owwDFYNP+G8/917WvYD4fY+rCk/3VWYmPC4f6SA VutQ== 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=6AR2ZUwcAh0vmjYEOu0eNTVNMoV0yrhbxAqfFJUy1vo=; b=rv+VT1fbjgPP9arw130/25TNfylCK31h/1cOjerXf93uoK08B+30Kpl2tzDP1GWz8S ZcE7WPfFUVSUg50LVeGSWzlGnA8+Idxx/gnSEBKUT05h2z9NcA/wQAYEY27AioDBG6xr JQ3dPpdBE+ELfdSobZ6D0KBZEmyuq2JjLExcIm/CqcWmRqDVge/m2iOXtAtQ95m2oHgb 8xP+DHCwb1s3G5G6DJ6VckMpKmFRpeyUbwy6TffErV6MzbCLeJsy8ACWECR+8vNo2QZW 33QyteROLXyJAL2tElXNpcDl2nCLq8pIXlxqFfXNA+kgx4HrIs8D2qQu9RLa0Yp456nh eswA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=px3MEXgV; 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 j3-20020a05620a410300b006fefb4b755csi4415534qko.6.2023.01.09.04.28.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:28: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=px3MEXgV; 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 1pEqyI-0000Hp-Lx; Mon, 09 Jan 2023 07:09: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 1pEqyG-0000Gv-Pj for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:44 -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 1pEqyF-0006FV-4t for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:44 -0500 Received: by mail-wr1-x431.google.com with SMTP id m7so7920743wrn.10 for ; Mon, 09 Jan 2023 04:09:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6AR2ZUwcAh0vmjYEOu0eNTVNMoV0yrhbxAqfFJUy1vo=; b=px3MEXgValMVaRZ/dR0QBv3hiWqXhFErKyPpV+/Y62pefAwG02tZfLyC41YNykXSKI P9YHUxjE6iBqlVNHN3zrK69l34MDwxHsv5vSjiWq+K/VrxlxOVzzeEBrq/wYWEEMbiNT oyLfM2wbn9KPzaK5Eb0Eag4qhSR7c6PhtWh41iWjb+avIXNGezde+zgSsFyn4aJ1O/si olCzVHYaocX06vgwvYd9xbCv0Z+/LjTPIte6xhLWnZYIM5JISZuOVwQ4fImoxuHIRXxX 7gFZi0HKS5VtN/GNysN/qXyaIFtSeRCbIQMUxiX60LCf0JSwOIAEb3besMJwBeJX1DGW qLAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6AR2ZUwcAh0vmjYEOu0eNTVNMoV0yrhbxAqfFJUy1vo=; b=ulILAjXGpMLmn2vGAFf6CuwpFhR5mA1ZnUQMcMa+ABJPo64OEBpv8soUJW6qUyFRdJ J4tT9Wb2zyUkn1eeQrwT0JFrmSezj1EKrzTXpHq/ptp3rDgTd30LwqyffPQ0CcnSALAj oZX3ZfK15wx//K3cs2MsnbXdtE8k3j0ZhaN4SUQbt0tSVgyCri9D9FxLHG6nwOPZmVKd QrE3GAZotGnYivDqpQG7SCHJRTfaKtuRtAPA1/JH/Ad+pCouqS8P9UkVmo3eOXnsElop 1tnzjsNiW5waiFwWpXr91fxXWFHxwNTI8jEHle/jLgXOuU2ihk5+eBsWuXw5Ks0VlVhs FMxA== X-Gm-Message-State: AFqh2koHgC7ePcMv0YoxqmAlJ6ZMsivIXDholSVsAifhI/K0pivJB8Kt f0GVSVzF2jVqox5H4uVDQeN8ce8NpqWcQq1j X-Received: by 2002:adf:f107:0:b0:284:5050:5e59 with SMTP id r7-20020adff107000000b0028450505e59mr29079963wro.29.1673266181579; Mon, 09 Jan 2023 04:09:41 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id bj7-20020a0560001e0700b002b6667d3adfsm8426733wrb.80.2023.01.09.04.09.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:41 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 14/21] hw/block: Remove unused pflash_cfi02_register() Date: Mon, 9 Jan 2023 13:08:26 +0100 Message-Id: <20230109120833.3330-15-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 We converted all caller of pflash_cfi02_register() by open coding a call to pflash_cfi02_create() followed by an explicit call to sysbus_mmio_map(); we can now remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/block/pflash_cfi02.c | 36 ------------------------------------ include/hw/block/flash.h | 13 ------------- 2 files changed, 49 deletions(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 55ddd0916c..6168e66d7e 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -993,39 +993,3 @@ static void pflash_cfi02_register_types(void) } type_init(pflash_cfi02_register_types) - -PFlashCFI02 *pflash_cfi02_register(hwaddr base, - const char *name, - hwaddr size, - BlockBackend *blk, - uint32_t sector_len, - int nb_mappings, int width, - uint16_t id0, uint16_t id1, - uint16_t id2, uint16_t id3, - uint16_t unlock_addr0, - uint16_t unlock_addr1, - int be) -{ - DeviceState *dev = qdev_new(TYPE_PFLASH_CFI02); - - if (blk) { - qdev_prop_set_drive(dev, "drive", blk); - } - assert(QEMU_IS_ALIGNED(size, sector_len)); - qdev_prop_set_uint32(dev, "num-blocks", size / sector_len); - qdev_prop_set_uint32(dev, "sector-length", sector_len); - qdev_prop_set_uint8(dev, "device-width", width); - qdev_prop_set_uint8(dev, "mappings", nb_mappings); - qdev_prop_set_uint8(dev, "big-endian", !!be); - qdev_prop_set_uint16(dev, "id0", id0); - qdev_prop_set_uint16(dev, "id1", id1); - qdev_prop_set_uint16(dev, "id2", id2); - qdev_prop_set_uint16(dev, "id3", id3); - qdev_prop_set_uint16(dev, "unlock-addr0", unlock_addr0); - qdev_prop_set_uint16(dev, "unlock-addr1", unlock_addr1); - qdev_prop_set_string(dev, "name", name); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - return PFLASH_CFI02(dev); -} diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 25affdf7a5..d615bf6a53 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -31,19 +31,6 @@ void pflash_cfi01_legacy_drive(DeviceState *dev, DriveInfo *dinfo); OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI02, PFLASH_CFI02) -PFlashCFI02 *pflash_cfi02_register(hwaddr base, - const char *name, - hwaddr size, - BlockBackend *blk, - uint32_t sector_len, - int nb_mappings, - int width, - uint16_t id0, uint16_t id1, - uint16_t id2, uint16_t id3, - uint16_t unlock_addr0, - uint16_t unlock_addr1, - int be); - /* nand.c */ DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id); void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale, From patchwork Mon Jan 9 12:08:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640625 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2103202pvb; Mon, 9 Jan 2023 04:25:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3eCI/BC4alWNMrRAPwG607rV5sfvQAHmTKsCKAcThFTl4OH9ELnxaGG3vt3IHk2yDEQKN X-Received: by 2002:ac8:6049:0:b0:3a7:f5fc:7cad with SMTP id k9-20020ac86049000000b003a7f5fc7cadmr86017960qtm.62.1673267149656; Mon, 09 Jan 2023 04:25:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267149; cv=none; d=google.com; s=arc-20160816; b=DpbW0LOKx+6dSifyblf99kKiSCp+FZ1k1Nvfctnzkz+OW4d/QXUphdnl5bzLxU7ncB 6w3FIyHoOZUuX7diVljMUrgeFOoZT7mW98sv/z2+SbaDrlsDwtkUz39PpVsxdjWwZYj+ NjzdUfzdP7ZzPeCKCxwLjAiBqvcK09crUSBLiDSPSF2a2utygFkP0fJCTWV6JS4ob/r9 R/s1AE62ox3WtnVPF1pmETITuUTc+FkrfSa5veOs1kwueDGK+eDeNiSjodNGaz3QjeE4 FWa7apccqWGanpYsAZ9bQ5tKK5TOVYxS2ta2s9dJSgJpFHVEOTSFI9+ohhfwbxjjjfTN ApsQ== 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=ZIp3JsnCZxhXt6GT6aUhF32nL0uOIOLvhkTscuIIgmA=; b=PD3wloqFk+Ri4uWG24z3mR7unz3c5ptVx0fs+U75h7jnplSmDGmlNYsvsWHTJy7foK xZtTX5ZiBrRd+FzsPKaJRne5LSuOFnCVbqHFFbMFXPmgWBIPJsxuxppTeaIxuDssrWZw Ja6aefG82Cisx3rSwYiE6hLMtI3H22xTQhnjqJxfParAEz/0cAcyyHeRAVf5YTiXS/4c 8fY6FircoyruqVldRh3hvlr3HGFhT0ul1Puwt/X5IkicfgVlFBro26godA7MqMTESvoQ kd+L/XQwdAZhZMKuapdIF9D+8km74eCeDH5l0gdlbQVAu0aX3+CAKoKucOOVAzRUUfS6 L22Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O2CJAPUO; 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 l6-20020ac81486000000b003a690945588si4186834qtj.684.2023.01.09.04.25.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:25:49 -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=O2CJAPUO; 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 1pEqyP-0000JC-61; Mon, 09 Jan 2023 07:09: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 1pEqyL-0000IG-Ne for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:49 -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 1pEqyJ-0006Gz-O7 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:48 -0500 Received: by mail-wm1-x32b.google.com with SMTP id g10so6105814wmo.1 for ; Mon, 09 Jan 2023 04:09:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZIp3JsnCZxhXt6GT6aUhF32nL0uOIOLvhkTscuIIgmA=; b=O2CJAPUOscrVtvbWCVYbN/6KrlrQXvAJmRdO16IY93pr6Pax3O33dgeTmtrnlEFQ4v PGzNsA7RG2f4m9LKZVgHMK/nbRpGVy97J94FaXbKkT0PeVj4R2Hg1vCd0PsNz1NsCFl1 3HQX3VsjNlbrOuozmkY9ces+WVJyV8dbT6tcLkKUWUxRMyadaI+cRDUTbytJ97R1ogo4 eUrCHuzhfClvJnwsey09Fdu9S0U6zxaNhsYVlpw6H8/ZPhS1Gg+83tV5nMh0HtCKaBF5 tBf/UuiwCsteXg41tSyM9p0sCecTfcHJ6cvLHIcVaAe94pyBePJHwNibUq3XFnc5YWbT WQaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZIp3JsnCZxhXt6GT6aUhF32nL0uOIOLvhkTscuIIgmA=; b=r5TWNvzAGHisulV+CbaZktUMsojQvfeWDH1yyvrU5sIqZ8O58Bbr4DJNvx6Z0ZwIlJ a4C25QK3G55gIGwGT2793IxVmcGHieSDT7ygyoXd3yVpFi7AVVuwtovdD6Z9eePdeitK TfdJ6LqtyNyeO4Jh77bpWRo5+qoYwoyDXpGGh+uuSoZ4oouQ0HrF8BAHpb66uD8inezT TipbJGQy2c0Jxoi0ht+BHCv8JbJDHR6uSxFV+DI0MWzcQbFPeEkYugecCQ8zuJr0zkJu C52Pc+bi2x7XLkgxMg8KKdFm/dlblJ5Ku75UaT2iJ7b6iF+HuGtB3M4dKcpV6RsxGJrT 34Uw== X-Gm-Message-State: AFqh2koXsNuqkZQ+GIroyydYftLBlFwxNn2n47XNx0yMPkg2WTS6sa+o McvrTT9d7oGU1tvLHJ5oa4QbbhGTJURgvrDs X-Received: by 2002:a05:600c:5116:b0:3d9:f296:1adc with SMTP id o22-20020a05600c511600b003d9f2961adcmr1341676wms.33.1673266186309; Mon, 09 Jan 2023 04:09:46 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id u8-20020a05600c19c800b003d9780466b0sm12398079wmq.31.2023.01.09.04.09.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 15/21] hw/block: Make PFlashCFI02 QOM declaration internal Date: Mon, 9 Jan 2023 13:08:27 +0100 Message-Id: <20230109120833.3330-16-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 Convert the QOM PFlashCFI02 to a forward/opaque pointer declaration. Only pflash_cfi02.c is able to poke at the internal fields. Reviewed-by: Bin Meng Signed-off-by: Philippe Mathieu-Daudé --- hw/block/pflash_cfi02.c | 2 ++ include/hw/block/flash.h | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 6168e66d7e..ba035d8d42 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -63,6 +63,8 @@ enum { WCYCLE_AUTOSELECT_CFI = 8, }; +OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI02, PFLASH_CFI02) + struct PFlashCFI02 { /*< private >*/ SysBusDevice parent_obj; diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index d615bf6a53..aeec4a369b 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -6,9 +6,8 @@ #include "exec/hwaddr.h" #include "qom/object.h" -/* pflash_cfi01.c */ - #define TYPE_PFLASH_CFI01 "cfi.pflash01" +#define TYPE_PFLASH_CFI02 "cfi.pflash02" OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI01, PFLASH_CFI01) @@ -25,11 +24,6 @@ BlockBackend *pflash_cfi01_get_blk(DeviceState *dev); MemoryRegion *pflash_cfi01_get_memory(DeviceState *dev); void pflash_cfi01_legacy_drive(DeviceState *dev, DriveInfo *dinfo); -/* pflash_cfi02.c */ - -#define TYPE_PFLASH_CFI02 "cfi.pflash02" -OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI02, PFLASH_CFI02) - /* nand.c */ DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id); From patchwork Mon Jan 9 12:08:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640645 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2126020pvb; Mon, 9 Jan 2023 05:13:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXu5PjMcnxcJ3wYdvggMxXpMwdLnpvDJRhfT9td9E8RxvnDI0MAtZVyj6F8qLQVncq6kEVKB X-Received: by 2002:a1f:a90e:0:b0:3d5:475f:94c with SMTP id s14-20020a1fa90e000000b003d5475f094cmr26440287vke.14.1673270010505; Mon, 09 Jan 2023 05:13:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673270010; cv=none; d=google.com; s=arc-20160816; b=Sr4pV9siSGOhm4k/hTjhZ1uk2rNdWIY+GLZHjk7NzG489uZceNd6iGQPJqUYKR3KFQ 8fo0Thwz1LuYvtU7xJ6M+ZyxAHTz9mANHi/4QlbL6i8BMy16GqSImsdL7DxDGW8IeE0m nETgWNRpBeOmDzgmTho2gs4+jHkw71m0mCjUfa5oerkoaTu9co+qZshuouvmiJU7oR3M i/N+I0cgctwb2Yo9BeQfbX2gAAISkPDqq/qLQ6JXmIzP4zjjzBBVtGgSmb5Q0lchH3r2 ucjWfFpaei8wx2IKTg7r0cM6ctbFn33uqHKq66cfgLornM2hw3VIrbDMmkRR4WlV92nC JXjw== 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=zWyHzmVIkAWuEo3FoJyuv2D5h+TutR6C3tqTyTBktJw=; b=GK+9M0lhzEEdHAkru7bp/lJWta6RQ9H1M88hGUTvWGECDDh7SEtfpqfrCzJQQLJHSF fBuahzAtuu2CNxBf1ine40PsQm0SEAVay/tzWZcc8wHdVogorxzLyH28p9EZtfR40bB6 P8gSGCpktcvq4mVEHHCakYc72OJ4UCA/i/EGtzQfs05dYOLwFKpuT37GRTKfgKu0cpEM xsdkNPC1U+AY5PCBzb9L0SqkmEQkyDD4TWntePcLqLWcUO+BXdQ9mLveEM30zC2wMG/3 3kefRjd8K5jUkVRtL0IEmNOEtOOe8UWEyNfWp1zjyzH7giv72cCxkp4NIZDlC05Sp3CE OGPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBHEmCls; 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 u20-20020a37ab14000000b006f61950a16bsi4155086qke.178.2023.01.09.05.13.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 05:13:30 -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=SBHEmCls; 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 1pEqyl-0000Nw-Sy; Mon, 09 Jan 2023 07:10:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pEqyR-0000KO-Ev for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:55 -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 1pEqyN-0006Gz-VT for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:09:54 -0500 Received: by mail-wm1-x32b.google.com with SMTP id g10so6105945wmo.1 for ; Mon, 09 Jan 2023 04:09:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zWyHzmVIkAWuEo3FoJyuv2D5h+TutR6C3tqTyTBktJw=; b=SBHEmClsm6N22wz+tMB45rhYkukPCNb0kEGT+Plif+C8pFl9+8y4X0VIrWgAya09aC FTfPXVn6IA+1crtYnnt8hqNGpOMNkd2jM4dcmeJuC/kFxFSr1k2oz5NVldNgq3cHh3iT Vw2Qn5MQ6G/YmMhES4SOHkD6Z82/Vo5VdOx60tLvrBBM9oU5MByDgIHkGG3/BUUvOh08 Z3NPfjvBMm4ATdX429fD/KrYgAz412amBlTzYnpbIr9msyfHPnB6VZWHH7j5VVkTPiMP XXjEqjn3a4nkH/0Ftr4SdKqETkqOrx/O06BxIKpJXu9il0LrmzQiOASbPP10KVCgqTPj 70Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zWyHzmVIkAWuEo3FoJyuv2D5h+TutR6C3tqTyTBktJw=; b=3pS4gLFYZeskh33p+hFBUGIFzwVwOPHw/OxyiPevxC+68K4ljdw0/FMOrYebHBvwBy bxBzxWtqisyrM+bGJOEGph43egiqyVb/lKx6ybSDpdxoqRSsWroKetNw+tC5wvloQtnC cohyLNoojm1Cwnf599/6uHxh5Vz2ZZO3elUMJ6r8rbfY+dd+3AXSLyIatE4L3W5eF1W/ RkRY29QHoAUIpzdiYK0FY6OEINWH9GdehiiDUYsMW/rLw6CPnTw7ztJRymaMVqCFY6sT 4jMoswTVRxNWiH9KzxxapxKAydChu0eYt2c4TvrwwM8OWvjLSSv1zul4V8cxUE2GfEWP QAdA== X-Gm-Message-State: AFqh2koQvwDkKMeyjFeQPNbgmjIZrB3HU7cvN308QOUIrbr6ZP/o+Uyn xONiL2wkEpgZI/1RSx2LMA6EcGAja3308gg7 X-Received: by 2002:a05:600c:2252:b0:3d3:5d8b:7af with SMTP id a18-20020a05600c225200b003d35d8b07afmr49001072wmm.41.1673266190932; Mon, 09 Jan 2023 04:09:50 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id he12-20020a05600c540c00b003d9ddc82450sm10934053wmb.45.2023.01.09.04.09.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 16/21] hw/arm: Open-code pflash_cfi01_register() Date: Mon, 9 Jan 2023 13:08:28 +0100 Message-Id: <20230109120833.3330-17-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 pflash_cfi01_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi01_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/collie.c | 16 ++++++++++++---- hw/arm/gumstix.c | 32 ++++++++++++++++++++++++++------ hw/arm/mainstone.c | 19 ++++++++++++++----- hw/arm/omap_sx1.c | 31 +++++++++++++++++++++++-------- hw/arm/versatilepb.c | 18 +++++++++++++----- hw/arm/z2.c | 17 ++++++++++++++--- 6 files changed, 102 insertions(+), 31 deletions(-) diff --git a/hw/arm/collie.c b/hw/arm/collie.c index 9edff59370..b0183f8ea2 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -11,11 +11,13 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/cutils.h" +#include "qapi/error.h" #include "hw/sysbus.h" #include "hw/boards.h" #include "strongarm.h" #include "hw/arm/boot.h" #include "hw/block/flash.h" +#include "hw/qdev-properties.h" #include "exec/address-spaces.h" #include "cpu.h" #include "qom/object.h" @@ -56,10 +58,16 @@ static void collie_init(MachineState *machine) for (unsigned i = 0; i < 2; i++) { DriveInfo *dinfo = drive_get(IF_PFLASH, 0, i); - pflash_cfi01_register(i ? SA_CS1 : SA_CS0, - i ? "collie.fl2" : "collie.fl1", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0); + DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", i ? "collie.fl2" : "collie.fl1"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", false); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, i ? SA_CS1 : SA_CS0); } sysbus_create_simple("scoop", 0x40800000, NULL); diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c index 2ca4140c9f..639317394d 100644 --- a/hw/arm/gumstix.c +++ b/hw/arm/gumstix.c @@ -37,10 +37,12 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "hw/arm/pxa.h" #include "net/net.h" #include "hw/block/flash.h" #include "hw/net/smc91c111.h" +#include "hw/sysbus.h" #include "hw/boards.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" @@ -58,6 +60,7 @@ static void connex_init(MachineState *machine) { PXA2xxState *cpu; DriveInfo *dinfo; + DeviceState *dev; cpu = pxa255_init(CONNEX_RAM_SIZE); @@ -69,9 +72,17 @@ static void connex_init(MachineState *machine) } /* Numonyx RC28F128J3F75 */ - pflash_cfi01_register(0x00000000, "connext.rom", CONNEX_FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "connext.rom"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", + CONNEX_FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 2); + qdev_prop_set_bit(dev, "big-endian", false); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x00000000); /* Interrupt line of NIC is connected to GPIO line 36 */ smc91c111_init(&nd_table[0], 0x04000300, @@ -82,6 +93,7 @@ static void verdex_init(MachineState *machine) { PXA2xxState *cpu; DriveInfo *dinfo; + DeviceState *dev; cpu = pxa270_init(VERDEX_RAM_SIZE, machine->cpu_type); @@ -93,9 +105,17 @@ static void verdex_init(MachineState *machine) } /* Micron RC28F256P30TFA */ - pflash_cfi01_register(0x00000000, "verdex.rom", VERDEX_FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 2, 0, 0, 0, 0, 0); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "verdex.rom"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", + VERDEX_FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 2); + qdev_prop_set_bit(dev, "big-endian", false); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x00000000); /* Interrupt line of NIC is connected to GPIO line 99 */ smc91c111_init(&nd_table[0], 0x04000300, diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index 68329c4617..b07193a375 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -129,12 +129,21 @@ static void mainstone_common_init(MachineState *machine, /* There are two 32MiB flash devices on the board */ for (i = 0; i < 2; i ++) { + DeviceState *dev; + dinfo = drive_get(IF_PFLASH, 0, i); - pflash_cfi01_register(mainstone_flash_base[i], - i ? "mainstone.flash1" : "mainstone.flash0", - MAINSTONE_FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 4, 0, 0, 0, 0, 0); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", + i ? "mainstone.flash1" : "mainstone.flash0"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", + MAINSTONE_FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", false); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, mainstone_flash_base[i]); } mst_irq = sysbus_create_simple("mainstone-fpga", MST_FPGA_PHYS, diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index 1d156bc344..7925ddd67e 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -31,8 +31,10 @@ #include "ui/console.h" #include "hw/arm/omap.h" #include "hw/boards.h" +#include "hw/sysbus.h" #include "hw/arm/boot.h" #include "hw/block/flash.h" +#include "hw/qdev-properties.h" #include "sysemu/qtest.h" #include "exec/address-spaces.h" #include "cpu.h" @@ -110,6 +112,7 @@ static void sx1_init(MachineState *machine, const int version) static uint32_t cs1val = 0x00215070; static uint32_t cs2val = 0x00001139; static uint32_t cs3val = 0x00001139; + DeviceState *dev; DriveInfo *dinfo; int fl_idx; uint32_t flash_size = FLASH0_SIZE; @@ -152,10 +155,16 @@ static void sx1_init(MachineState *machine, const int version) fl_idx = 0; if ((dinfo = drive_get(IF_PFLASH, 0, fl_idx)) != NULL) { - pflash_cfi01_register(OMAP_CS0_BASE, - "omap_sx1.flash0-1", flash_size, - blk_by_legacy_dinfo(dinfo), - SECTOR_SIZE, 4, 0, 0, 0, 0, 0); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "omap_sx1.flash0-1"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", flash_size / SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", false); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, OMAP_CS0_BASE); fl_idx++; } @@ -171,10 +180,16 @@ static void sx1_init(MachineState *machine, const int version) memory_region_add_subregion(address_space, OMAP_CS1_BASE + FLASH1_SIZE, &cs[1]); - pflash_cfi01_register(OMAP_CS1_BASE, - "omap_sx1.flash1-1", FLASH1_SIZE, - blk_by_legacy_dinfo(dinfo), - SECTOR_SIZE, 4, 0, 0, 0, 0, 0); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "omap_sx1.flash1-1"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH1_SIZE / SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", false); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, OMAP_CS1_BASE); fl_idx++; } else { memory_region_init_io(&cs[1], NULL, &static_ops, &cs1val, diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c index 43172d72ea..e5da688fe4 100644 --- a/hw/arm/versatilepb.c +++ b/hw/arm/versatilepb.c @@ -385,11 +385,19 @@ static void versatile_init(MachineState *machine, int board_id) /* 0x34000000 NOR Flash */ dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi01_register(VERSATILE_FLASH_ADDR, "versatile.flash", - VERSATILE_FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - VERSATILE_FLASH_SECT_SIZE, - 4, 0x0089, 0x0018, 0x0000, 0x0, 0); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "versatile.flash"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", + VERSATILE_FLASH_SIZE / VERSATILE_FLASH_SECT_SIZE); + qdev_prop_set_uint64(dev, "sector-length", VERSATILE_FLASH_SECT_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", false); + qdev_prop_set_uint16(dev, "id0", 0x0089); + qdev_prop_set_uint16(dev, "id1", 0x0018); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, VERSATILE_FLASH_ADDR); versatile_binfo.ram_size = machine->ram_size; versatile_binfo.board_id = board_id; diff --git a/hw/arm/z2.c b/hw/arm/z2.c index dc25304290..867aef7d87 100644 --- a/hw/arm/z2.c +++ b/hw/arm/z2.c @@ -13,14 +13,17 @@ #include "qemu/osdep.h" #include "qemu/units.h" +#include "qapi/error.h" #include "hw/arm/pxa.h" #include "hw/arm/boot.h" #include "hw/i2c/i2c.h" #include "hw/irq.h" #include "hw/ssi/ssi.h" #include "migration/vmstate.h" +#include "hw/sysbus.h" #include "hw/boards.h" #include "hw/block/flash.h" +#include "hw/qdev-properties.h" #include "ui/console.h" #include "hw/audio/wm8750.h" #include "audio/audio.h" @@ -307,14 +310,22 @@ static void z2_init(MachineState *machine) void *z2_lcd; I2CBus *bus; DeviceState *wm; + DeviceState *dev; /* Setup CPU & memory */ mpu = pxa270_init(z2_binfo.ram_size, machine->cpu_type); dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi01_register(Z2_FLASH_BASE, "z2.flash0", Z2_FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 4, 0, 0, 0, 0, 0); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "z2.flash0"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", Z2_FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", false); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, Z2_FLASH_BASE); /* setup keypad */ pxa27x_register_keypad(mpu->kp, map, 0x100); From patchwork Mon Jan 9 12:08:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640618 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2100725pvb; Mon, 9 Jan 2023 04:19:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzXJvebfOcc//YyXlzLZ3k8fKir4/w6BlyLA0LueJ+p7TrC9nJgsx8HHnQ+a9Ol4ovjF87 X-Received: by 2002:a05:622a:4184:b0:39c:da20:f7e2 with SMTP id cd4-20020a05622a418400b0039cda20f7e2mr81978957qtb.63.1673266780170; Mon, 09 Jan 2023 04:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266780; cv=none; d=google.com; s=arc-20160816; b=RDlSOwouVWIywFlnDgPJUJbfR+Gi/XAbZ3VKA2FQYyfhwfO8HJ3NVEpIqbupEKDeI4 yULdOxSyCI2gNvPEWiiHuBxTTugcAlFydzlA2s/eRqtokCIN0C0zJToFDujp2FPHbW2V pcRbHfd4f6VzbF/VWfAV2FGxl/pfBZA1qyNWDlhUUEXyp1BWblzqWvhMh0JY+SzB6uxY P5UlZujcs/AoerqYQdaVCrzlD8Ks2x2lcfdTxfNzyn+KXR3SNxOz6xdbwItWdSVObmXM wdKd2hu2/k1gH6j1xjE36CD8qZ0YGaML1ve4GKDK0CDYWj2syhnhegvBFzRjok+PEv4k ocDg== 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=liSrsQbWrTyCFqiebgmf51mkmbO99zfOxESuyl/01rg=; b=jZxaPAHV/7iQT2F/0iJLC0qpA6EbDcHZeS8HHhWO9HvG2DtOg8LWWtEGTNOYjRiasZ 2yXPzfj/EUe9ZhpmupL+GC1t/8veWcq8Ymn/TE5SR08QXXOeBxcTvo8MYSiTXhkX21tc E2foHxMd0q9CG4X8X1qVnWu/6QQvqpTygNJDFDU1L1RhzE37ytVr1yZe663tLECw2Q9T cgmUVA23dpB+/E5NE++BlVVA0jeBriWK8h2shXceC6hQQRzaLZoxUGEbfzlgqXyP/7ZS oacxS/0vw+ccvFB1r7908EodcewehrvuGuvXlU+/h/Hs6TsHj9e6bfOH5PN1kA9vcFf7 vgcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCXmd71e; 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 m10-20020ac807ca000000b00397ce0788ffsi4444715qth.525.2023.01.09.04.19.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:19: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=NCXmd71e; 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 1pEqyz-0000YJ-5M; Mon, 09 Jan 2023 07:10:29 -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 1pEqyY-0000Np-0m for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:02 -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 1pEqyW-0006pC-Af for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:01 -0500 Received: by mail-wm1-x336.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so4001455wma.1 for ; Mon, 09 Jan 2023 04:09:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=liSrsQbWrTyCFqiebgmf51mkmbO99zfOxESuyl/01rg=; b=NCXmd71e54vsqVAA3Jz795xx3dZy/ZYfYk50sSmWrl1HmFv+m9EL0Kvy3WKKMOV2h/ LmJ05YuhK3wd8wwQd9szq18ekPMzaiAQRtX1aNOD3RNqaZ3WcFhF/O1DoqWisbbIC8Fe f5J0l66DxeLHMcs27J1E4ILFphGD4W58VICUn4NB9VM5oXRb2kXLuwAKJGhh4Lxy2rhy hJXgGXVEmh3p301yzsqoD3CcZeqm+06+Q5ILmvUG+rucSuA7HZ5mQZDFBFCyvbT/jLIQ skvir0aynQCPg65AzBoTn4TP7o2Ua3OMhvgB8ccA0ZWV+ZdjaitxIMvt5DzIaltctJyf rTQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=liSrsQbWrTyCFqiebgmf51mkmbO99zfOxESuyl/01rg=; b=wffLfzIuQKYttLRYBHXFuypG/HFJr6xWqAW/r/aR5Al4utQP9W+vlADWe1b9d/PvLY UwG+AfQsmTk3B+wWY2tR44/2mwUtne+3ujYkAL5ih2fckkh9vyFgxSKDNBrDZnukeBiU FwqrnNbKCckdlO+tH8Nzjw6urin0NHQLeMOpo9HtG/iyMf+E8E+56LLxl0AM/a7NwAcP Peb23vLGxaQf0Id8zkD0dpRfmGugfJSOUwn2ZxvDvUgkqsThTk67D43FgJiVIDfk0aT2 hoIO6ilIA6sOxOqpwkW2asbSn3a55zQqy6zJ8ASspYH6mq8CLdiPvVm/kgsr+RSlTvjk oEzw== X-Gm-Message-State: AFqh2kp028KbamdoWr8K7bm+au0y4P2YXRmmlJCChdonmGzErWRU5tEu iOnVbTeGt2tpM4QWWD489LtmJAossJljrXE1 X-Received: by 2002:a05:600c:687:b0:3cf:e7c8:494 with SMTP id a7-20020a05600c068700b003cfe7c80494mr46162728wmn.29.1673266195710; Mon, 09 Jan 2023 04:09:55 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id p15-20020a1c544f000000b003b4fe03c881sm15491003wmi.48.2023.01.09.04.09.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:09:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 17/21] hw/microblaze: Open-code pflash_cfi01_register() Date: Mon, 9 Jan 2023 13:08:29 +0100 Message-Id: <20230109120833.3330-18-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org pflash_cfi01_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi01_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé --- hw/microblaze/petalogix_ml605_mmu.c | 18 ++++++++++++------ hw/microblaze/petalogix_s3adsp1800_mmu.c | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c index 1888900156..84db4413c0 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -104,12 +104,18 @@ petalogix_ml605_init(MachineState *machine) memory_region_add_subregion(address_space_mem, MEMORY_BASEADDR, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); - /* 5th parameter 2 means bank-width - * 10th paremeter 0 means little-endian */ - pflash_cfi01_register(FLASH_BASEADDR, "petalogix_ml605.flash", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 2, 0x89, 0x18, 0x0000, 0x0, 0); - + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "petalogix_ml605.flash"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 2); /* bank-width */ + qdev_prop_set_bit(dev, "big-endian", false); + qdev_prop_set_uint16(dev, "id0", 0x0089); + qdev_prop_set_uint16(dev, "id1", 0x0018); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, FLASH_BASEADDR); dev = qdev_new("xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", 1 << TIMER_IRQ); diff --git a/hw/microblaze/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c index d14eff2514..94d85d6ec2 100644 --- a/hw/microblaze/petalogix_s3adsp1800_mmu.c +++ b/hw/microblaze/petalogix_s3adsp1800_mmu.c @@ -85,10 +85,18 @@ petalogix_s3adsp1800_init(MachineState *machine) memory_region_add_subregion(sysmem, ddr_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi01_register(FLASH_BASEADDR, - "petalogix_s3adsp1800.flash", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, 1, 0x89, 0x18, 0x0000, 0x0, 1); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "petalogix_s3adsp1800.flash"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 1); /* bank-width */ + qdev_prop_set_bit(dev, "big-endian", true); + qdev_prop_set_uint16(dev, "id0", 0x0089); + qdev_prop_set_uint16(dev, "id1", 0x0018); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, FLASH_BASEADDR); dev = qdev_new("xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", From patchwork Mon Jan 9 12:08:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640624 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2102843pvb; Mon, 9 Jan 2023 04:24:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXsfA1sTGPRSl0RMqV6THmQc+mBgPZ8uRCXqFZnrwC1N3yTHPvL+tHzADbtEaGZv72mpLluO X-Received: by 2002:a05:622a:1f13:b0:3a5:3234:cc7b with SMTP id ca19-20020a05622a1f1300b003a53234cc7bmr92901555qtb.65.1673267089186; Mon, 09 Jan 2023 04:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267089; cv=none; d=google.com; s=arc-20160816; b=nOQvqVAyDYabahtfiNXWKndFBPVnkk2BsWcAKvjJxPz6CK5jDQGNWApYeYJh0hpEFb K7l1d10aj5yfGKMkSPnA1PM2SPLodY+u3xwK/uyyDs9JpkhGt6Xe4Qig06t14dVa9I7j EklfqNzTs3sVh9mU2PqXR0g71C6uatUxnTD65EzBb7avfMp11FRSACUt18JUbbu4kE24 UNxx0sIGLOSEpnmDk330tQzwAK76hDJZV6BKQlGsQv/5drTF0PjVo4tN6ye+m0z97fAd UFb628dDEpjji5QCj1diELVCLo077oENnG0MgcXh6d7mluWSxrGksbLvkXZVLV+V9/or b+9Q== 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=GrtKRjVCEXmnX65xOqafU/4NBjLWdOq8NqX2Mi8y/bQ=; b=0umVZZL18h2tmNYkBNC4uTVID9Ssg/nzCHEzGYlOjiv3wqoojyhlbgWF4d4ZTcUA7J mU41v4bxCcf51/yP+SN90MvIRte2/Q4RdKGiXdN4ndcN4Wq3PXu8JSJavW8Qwhg+XFnX VcpxJbX9DEfzVf8NBcDf2y0yNNniNRnishw5HgTC0Xc8HIgChud2LU/dKDMORP8KzfjR 2Eub5B1g/U6cV9Djc7FNnzyDakCaT0dZAtRF/wd1g0fEBPyxjBZgU6io3CsJmMavPl49 0iozB23YI1KDf6ov342zAXnnY1/7pIcgnkRyL/3qzCAZ4J5SE7LykilrtBRZ03dPcPVB hgqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vWiqiUge; 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 gd22-20020a05622a5c1600b003a81bb6a1c4si4455777qtb.406.2023.01.09.04.24.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:24:49 -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=vWiqiUge; 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 1pEqz2-0000YR-VM; Mon, 09 Jan 2023 07:10: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 1pEqyd-0000P9-Vp for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:12 -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 1pEqyY-0006qD-3S for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:06 -0500 Received: by mail-wr1-x433.google.com with SMTP id d17so7940579wrs.2 for ; Mon, 09 Jan 2023 04:10:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GrtKRjVCEXmnX65xOqafU/4NBjLWdOq8NqX2Mi8y/bQ=; b=vWiqiUgel9gqgFUMk2dMTHnaIgThkHBREXtOZXsU6EXQs3kSu9VWAgILixHYtfSUFx s+FyoYULt2UIF7k67DNcJGSK8Iq+xnQ+wNsAJvNF06dtWj7E3F1KXEYUEhJXP6zaB2Ch 9M7Vcl2Y7fTvS17Ym5/wTa0f8iUg+lk+zN6GJd9je9Usgm2HErr6D7Bh74rawr4dZlp4 1gHuTNi7CI0ZSCoeWiHhGQ1UKHmSUgaod7FHLAUrHadVazkKJdUascBxV4p0NULNHrCC KibeLmJuLPvD4Q6jxiQBr7W0suh0hkRw+/Vx24GvgQFs5rQ72WPYXeTtACBZ2IVwf9OU D/XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GrtKRjVCEXmnX65xOqafU/4NBjLWdOq8NqX2Mi8y/bQ=; b=gT0IhO8HrRULK38dXjVoC3bqeNPAhzah6jTdFXrcQgLDv4d6t3uyrSdbey2/pxoRhX 71U9Pr/eDtIEvb10BGiKJTcjEzhQm0j/mfAgkQVjeAkWdUo5H5pcWkMHO/rwSQ+GadDr ihm7CoPcq9NaWWNwkefTHHroXq+DESK0OMdQXOXmPp7gtXrWJL7X2ALdCFmkICQ8FQss eM5Nk/hiTW3S+Ghuc5tQHM8+PMXi975Az+o2ZDR9Vt2amqcfkOQXNL/qkKYbQdrP9y38 vbPUP3Rj9hpvBInbb61RYILpY8SmBu1wBGxLweIipjLuRJef5XFiVmqybFjqUNMUmJ34 Cv/A== X-Gm-Message-State: AFqh2kop2/UNulnFoCEUPBBdjqmTUadtS1xjYlpVGa63VJVbt/Jt4ygi cOoMlFu3OFZ3KgLefqnR+Yx2sIl4aODNsuaO X-Received: by 2002:adf:d084:0:b0:278:29ac:f894 with SMTP id y4-20020adfd084000000b0027829acf894mr31387214wrh.64.1673266200602; Mon, 09 Jan 2023 04:10:00 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id c18-20020adffb52000000b0025e86026866sm9874017wrs.0.2023.01.09.04.09.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:10:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 18/21] hw/mips: Open-code pflash_cfi01_register() Date: Mon, 9 Jan 2023 13:08:30 +0100 Message-Id: <20230109120833.3330-19-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org pflash_cfi01_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi01_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/malta.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 9657f7f6da..4605b06b3b 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1223,7 +1223,6 @@ void mips_malta_init(MachineState *machine) const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; char *filename; - PFlashCFI01 *fl; MemoryRegion *system_memory = get_system_memory(); MemoryRegion *ram_low_preio = g_new(MemoryRegion, 1); MemoryRegion *ram_low_postio; @@ -1287,12 +1286,16 @@ void mips_malta_init(MachineState *machine) /* Load firmware in flash / BIOS. */ dinfo = drive_get(IF_PFLASH, 0, fl_idx); - fl = pflash_cfi01_register(FLASH_ADDRESS, "mips_malta.bios", - FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - FLASH_SECTOR_SIZE, - 4, 0x0000, 0x0000, 0x0000, 0x0000, be); - dev = DEVICE(fl); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "mips_malta.bios"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / FLASH_SECTOR_SIZE); + qdev_prop_set_uint64(dev, "sector-length", FLASH_SECTOR_SIZE); + qdev_prop_set_uint8(dev, "width", 4); + qdev_prop_set_bit(dev, "big-endian", be); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, FLASH_ADDRESS); bios = pflash_cfi01_get_memory(dev); fl_idx++; if (kernel_filename) { From patchwork Mon Jan 9 12:08:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640639 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2111423pvb; Mon, 9 Jan 2023 04:44:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXthi+VcQJy9cH0HADHP6+sVQZXkS2e14c70t7bfO6m/fYC55uAWnrR2V45sDbAifCUU1r8e X-Received: by 2002:a05:6214:247:b0:51e:268a:e78b with SMTP id k7-20020a056214024700b0051e268ae78bmr84660803qvt.33.1673268279878; Mon, 09 Jan 2023 04:44:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268279; cv=none; d=google.com; s=arc-20160816; b=pFMCtcCC3dLIz0IHTFS0XUBw6CA91y4EswQsYnixCC2ZluEhyAEQyEOo+Pbk9mDq1w hKBmHuMCMcAC9u6iZvXD4G9uRvQz1MuLwaTcuBSNCBCB7kGM4DhNueT8yIG8eTkDRMih IfjpCED9toYbgK/zE4+uMC5z4w3I72r1Ji8LR1xEtONF3u26DTvguoW9X80zRfVMoFFQ 23VSDAWRKF2Q8UiZI1hAJSSCYkv1Qef5AtIoHwuZEGLJOxwfWLIrhEzy7OWgs9+jXgn3 8lp5xCYt6L6r2Qxt9hGSlMPinwC3Ui6MXAiD1/FV+IXfP4SSMF8X7RjQwLtA5dZYXWvO hQ2w== 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=tnHz5pT3+i4xDM6inKPhqyLsvi12m2D1eIZxQ/5bEAw=; b=bG4QxEgVCFFI2OMF2IzMSN38YtmHUgH6oCZwf4a5RPr0D7ZgmvYkoZ8RnoJs/WyUSL 7ljuMGUFt9CcrfQCTbAQfeCw1BKKHPx5BcOYzfoFaCjwrAkPwW/nvwYYTOZxmyAybZIH hS9u2nZGWVSTvvwNVYkigm3xfSHlnX4E7K7wQ0d4DgquU8Nx7nTs9WhzN1l7FJ0zwCjC 1YVoiXV2Drv08a89b7EY1IywSSMLyxkc/FR4rUCCu1gNTri21BRc9PXMnjfXLdSzefTs iMz7L0e6yv9KRX4rgItBmg1qmggWWhW/ImnitehxEa/IWQP85UOuvNma62pykH8rt9n5 u6lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KDXgpqfd; 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 12-20020a37060c000000b006fee7e2a71esi4426686qkg.204.2023.01.09.04.44.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:44: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=KDXgpqfd; 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 1pEqz4-0000d5-GT; Mon, 09 Jan 2023 07:10: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 1pEqym-0000U3-E9 for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:19 -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 1pEqyd-00072S-Um for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:14 -0500 Received: by mail-wm1-x335.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so8821929wms.0 for ; Mon, 09 Jan 2023 04:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tnHz5pT3+i4xDM6inKPhqyLsvi12m2D1eIZxQ/5bEAw=; b=KDXgpqfdxgT7RO04VyC5q0FG8xImDYad0HLtYR2qUL5xrpwKr/2mBRC4AQGhYdtERw z02F2+eDe+WYJLCuYyVJcfmr65N3do14SYSURoUX6FeLxWiQcBBIA0/Huv/i3I2qq9M7 28FJFf/AeE7o94Q7BYvt3vRcR2wjwK/P5PcCPc4pBRZZDH2f51KfhdlyMyRMtRGyoT9r UYHCb6HTYQAngIh+q6WT6hcvV5UHLdaBcMNTtHwx2y7XJdcwld/kub3TuCaPk+xzkaK2 VkxzFj8syhCZh9GubhthRgd7MP6IKlRVIbZTcx6T7xcTGWGb3BpCJgoD61WF596VBkSv 7V5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tnHz5pT3+i4xDM6inKPhqyLsvi12m2D1eIZxQ/5bEAw=; b=JpPWA4b+fdbf/rrihDfZkgTvhw7loJDsfZNcJku8r37TB59wtvDA6Mhzvma+sl7rFs MWmV/DbrtW+qQJhHGppT9OXH2GjSIe5LFzix5T5EVE2OC3+2/9bHA5dcr6bwuFswWD42 Cg43eJoPyhOppKOu6HZQB3EdV9itQj7dxI6ismLJtkSywsUFtM+OKziliV29LMt8/w2H /qnbXXQ3Ei/yFOs2IHOZfMRVJxKeO0IbBLtpfk1+Qm8rVkqlCAWvKRqM0bE5bqxCxiue sE4xD8Zi0lGEH58gN8lAR8A3o1J0OmxWZq9qd2M3sToVcSHKGnQwuQ0Zsl/Uuhy4R+6J YmoA== X-Gm-Message-State: AFqh2kqZxDQ3tn5pwKL9SEkHi9i4UsTvq4Utc7gRrVuA4UKokLpQoPQe j4rpuV+OMq62pCBMsuTe9EndM3geIWNajV1K X-Received: by 2002:a7b:c3c1:0:b0:3c7:1359:783b with SMTP id t1-20020a7bc3c1000000b003c71359783bmr46022830wmj.1.1673266206264; Mon, 09 Jan 2023 04:10:06 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id o9-20020a05600c510900b003c6f8d30e40sm17551744wms.31.2023.01.09.04.10.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:10:05 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 19/21] hw/ppc: Open-code pflash_cfi01_register() Date: Mon, 9 Jan 2023 13:08:31 +0100 Message-Id: <20230109120833.3330-20-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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 pflash_cfi01_register() hides an implicit sysbus mapping of MMIO region #0. This is not practical in a heterogeneous world where multiple cores use different address spaces. In order to remove pflash_cfi01_register() from the pflash API, open-code it as a qdev creation call followed by an explicit sysbus mapping. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: BALATON Zoltan --- hw/ppc/sam460ex.c | 19 ++++++++++++++----- hw/ppc/virtex_ml507.c | 15 ++++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index cf7213f7c9..d2bf11d774 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -99,14 +99,23 @@ static int sam460ex_load_uboot(void) * * TODO Figure out what we really need here, and clean this up. */ - + DeviceState *dev; DriveInfo *dinfo; dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi01_register(FLASH_BASE | ((hwaddr)FLASH_BASE_H << 32), - "sam460ex.flash", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - 64 * KiB, 1, 0x89, 0x18, 0x0000, 0x0, 1)); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "sam460ex.flash"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / (64 * KiB)); + qdev_prop_set_uint64(dev, "sector-length", 64 * KiB); + qdev_prop_set_uint8(dev, "width", 1); + qdev_prop_set_bit(dev, "big-endian", true); + qdev_prop_set_uint16(dev, "id0", 0x0089); + qdev_prop_set_uint16(dev, "id1", 0x0018); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, + FLASH_BASE | ((hwaddr)FLASH_BASE_H << 32)); if (!dinfo) { /*error_report("No flash image given with the 'pflash' parameter," diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index f2f81bd425..2532806922 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -233,9 +233,18 @@ static void virtex_init(MachineState *machine) memory_region_add_subregion(address_space_mem, ram_base, machine->ram); dinfo = drive_get(IF_PFLASH, 0, 0); - pflash_cfi01_register(PFLASH_BASEADDR, "virtex.flash", FLASH_SIZE, - dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, - 64 * KiB, 1, 0x89, 0x18, 0x0000, 0x0, 1); + dev = qdev_new(TYPE_PFLASH_CFI01); + qdev_prop_set_string(dev, "name", "virtex.flash"); + qdev_prop_set_drive(dev, "drive", + dinfo ? blk_by_legacy_dinfo(dinfo) : NULL); + qdev_prop_set_uint32(dev, "num-blocks", FLASH_SIZE / (64 * KiB)); + qdev_prop_set_uint64(dev, "sector-length", 64 * KiB); + qdev_prop_set_uint8(dev, "width", 1); + qdev_prop_set_bit(dev, "big-endian", true); + qdev_prop_set_uint16(dev, "id0", 0x0089); + qdev_prop_set_uint16(dev, "id1", 0x0018); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, PFLASH_BASEADDR); cpu_irq = qdev_get_gpio_in(DEVICE(cpu), PPC40x_INPUT_INT); dev = qdev_new("xlnx.xps-intc"); From patchwork Mon Jan 9 12:08:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640629 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2104304pvb; Mon, 9 Jan 2023 04:28:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXsvyPXKbLR4jqRNu5Y06E/pXnbl1wA6YvuDm1Gr43XuztkljNPvrwKbfOyAzr8sbUs1hPEY X-Received: by 2002:a05:622a:4007:b0:3a8:3039:a702 with SMTP id cf7-20020a05622a400700b003a83039a702mr82204541qtb.43.1673267309537; Mon, 09 Jan 2023 04:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267309; cv=none; d=google.com; s=arc-20160816; b=TfL3cQ4ml/2tO0gIQ/UkOnt1EmDnMgJA9xVgkvUMaCCUv4s+TEC9keyTyGcwf+IExU SqOcv7i1vqfnt1w7DuGM+woGWcGXbfkvFITxfruBRTv+W0DkH/EYMJT55BtXRsE1F2fI jt0Tr2+FRGli5juldp5jb29PJu+TpCBv5fo3BmYUQPbzofBFYNOqIOPCOvwf+3sZTgY9 GaZTQ1j5Rhf5omxjsIASsjyGx1LhRW+ybY/ZT2uNSAUDtfkUs/zIehxtj+nyIZfq0Tj0 AmJVUqApNLeJ3UiK7SiBSKApGIiS2PVCc3zY4qfwbxhJAJHAa9Gdwce+P4LhVWyRLPKd qHIw== 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=CQ5ASrGaNWsN6DpEPRppXsFKltp3KdI23QpZkfV//Sk=; b=U129cWrHaIY1RlhwtutEgoO/saLqVl/GzJY9mQaa37NbT+dXxH1SQ1GkGCdOmiVrIo SqYuSaYKnu42BTUnRg3NyWAWSPTw/xjINEKOHvNBOhbYq1sWI3F+6Dgd2ucAOHV5OKHX izDvzW0bs967EvHIAGpeat7OP+gDAYfeLvk9aUIaSsG/+Qz/CJYYyjNfO7wiE79XA1h7 8SvMcjTZZDPU2nd15zQ+EhYhDrCCKOdRiIRmJuifYniOV3lrnZsDwUtlM7eCB1FHJjwX nK57rQG3IMG55ISEotgxHJFJ6l1c8zzgDIuinoOpwVyCXUWUtY0JIGS869JqDW0/VGNg yrMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=upJZb1eD; 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 cj13-20020a05622a258d00b0035d20f40dbdsi4451566qtb.479.2023.01.09.04.28.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04:28: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=upJZb1eD; 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 1pEqz3-0000cB-PD; Mon, 09 Jan 2023 07:10: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 1pEqyn-0000US-NT for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:19 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pEqyj-00075j-Te for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:17 -0500 Received: by mail-wr1-x430.google.com with SMTP id z5so6873536wrt.6 for ; Mon, 09 Jan 2023 04:10:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CQ5ASrGaNWsN6DpEPRppXsFKltp3KdI23QpZkfV//Sk=; b=upJZb1eD8JaPoGdmoCWTf0TpmPHJ0MC9/P7h+KSI6ZV0vN2oWKamdQaOJCir2QR/8+ nxb/KxoseEqdtvqdTn7GwEvleaggxf1k/cGOQbPJ8p7ebV/pWYL1HRE290g2eXMZlO+Q Om+hZB88tCjZnQvVCBGTEFqXX6ZDWGgmra9jDmHIzetUHtqlevzxK+h8orWsNgsw0Rn2 HzRr67mUZTBMOgYE7xn+o7PAcvJdM14JTKGfIoQQV7qfPKTF+FRhl8pQg6ga53ZR5U08 om8q3OMdtubU7AKKZS3MYwHIqLOxB1j8HzjtNtMqes9LP6ZykdoiBb1vwAvefSRPPy63 j2ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CQ5ASrGaNWsN6DpEPRppXsFKltp3KdI23QpZkfV//Sk=; b=VVKluF0/tnFAaWUyrsdNIFES5D/hYV16MuO4yfJ2mA7E8LcYT4H2O9vnQ3nujeLgtE l0naIw2UFijlNMtNetlEBOTANi3ViXk9F1MpgT/b57r2h2O3xofqjcaxR9ST6vqDuEJt 8Qgb71RU2reHvlB4BBVafQ390Am71+mDaYAcmXDMpal1gL5xM6raxr2EhCEr252RAu7o bA1HswOTmXTU+1mkn/XahguogJyWzw5gSUKSdqws5ZV4eIv2KL7V/zirKJ8j+xGWlaXo UKxJzIrdHC1CxkLQs47iuteA3G5ho6FUoxqY6wl9f7FhZ9lhAsXXsmsCHaWy8N5haAMB jIWA== X-Gm-Message-State: AFqh2kqbRIqckIKsCxOdKYcJrPLgFSIPqb/OT6kDi2LUsuaQnaRk6oLA oWCqTnHKzprnycst+Dz1kSWGfUSCvhJsPQyV X-Received: by 2002:a5d:4f05:0:b0:28c:6430:c1bc with SMTP id c5-20020a5d4f05000000b0028c6430c1bcmr23392843wru.3.1673266211224; Mon, 09 Jan 2023 04:10:11 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id a26-20020a5d457a000000b0028e8693bb75sm9712113wrc.63.2023.01.09.04.10.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:10:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 20/21] hw/block: Remove unused pflash_cfi01_register() Date: Mon, 9 Jan 2023 13:08:32 +0100 Message-Id: <20230109120833.3330-21-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We converted all caller of pflash_cfi01_register() by open coding a call to pflash_cfi01_create() followed by an explicit call to sysbus_mmio_map(); we can now remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- hw/block/pflash_cfi01.c | 31 ------------------------------- include/hw/block/flash.h | 10 ---------- 2 files changed, 41 deletions(-) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 866ea596ea..4e74c9e0d9 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -953,37 +953,6 @@ static void pflash_cfi01_register_types(void) type_init(pflash_cfi01_register_types) -PFlashCFI01 *pflash_cfi01_register(hwaddr base, - const char *name, - hwaddr size, - BlockBackend *blk, - uint32_t sector_len, - int bank_width, - uint16_t id0, uint16_t id1, - uint16_t id2, uint16_t id3, - int be) -{ - DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01); - - if (blk) { - qdev_prop_set_drive(dev, "drive", blk); - } - assert(QEMU_IS_ALIGNED(size, sector_len)); - qdev_prop_set_uint32(dev, "num-blocks", size / sector_len); - qdev_prop_set_uint64(dev, "sector-length", sector_len); - qdev_prop_set_uint8(dev, "width", bank_width); - qdev_prop_set_bit(dev, "big-endian", !!be); - qdev_prop_set_uint16(dev, "id0", id0); - qdev_prop_set_uint16(dev, "id1", id1); - qdev_prop_set_uint16(dev, "id2", id2); - qdev_prop_set_uint16(dev, "id3", id3); - qdev_prop_set_string(dev, "name", name); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base); - return PFLASH_CFI01(dev); -} - BlockBackend *pflash_cfi01_get_blk(DeviceState *dev) { PFlashCFI01 *fl = PFLASH_CFI01(dev); diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index aeec4a369b..20e5424525 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -11,20 +11,10 @@ OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI01, PFLASH_CFI01) -PFlashCFI01 *pflash_cfi01_register(hwaddr base, - const char *name, - hwaddr size, - BlockBackend *blk, - uint32_t sector_len, - int width, - uint16_t id0, uint16_t id1, - uint16_t id2, uint16_t id3, - int be); BlockBackend *pflash_cfi01_get_blk(DeviceState *dev); MemoryRegion *pflash_cfi01_get_memory(DeviceState *dev); void pflash_cfi01_legacy_drive(DeviceState *dev, DriveInfo *dinfo); - /* nand.c */ DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id); void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale, From patchwork Mon Jan 9 12:08:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 640638 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2111186pvb; Mon, 9 Jan 2023 04:44:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXsmclNHiyHeF/foQWfjyuPCVjL6WYWEQRwZ61/InuJUzFCicZ7p9w/i2ZL+cegf+PpDeXTs X-Received: by 2002:a0c:f7c1:0:b0:532:1018:2b22 with SMTP id f1-20020a0cf7c1000000b0053210182b22mr21117393qvo.2.1673268249341; Mon, 09 Jan 2023 04:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673268249; cv=none; d=google.com; s=arc-20160816; b=MqixOg0QDDdI7Kv/SNZQIwwvuSUBNJ9djHfB9RMmARGtH0xqQVH5wtZHf17Gh9XLiu GeBCInfbd2laCcJIe1xlt++emUquAoCWipGS7Ef6hh00vB3SRayQpcG3TbJsO3b+8WpN QgjCSgRCIIxk25meV1AAdMns3GDIGyQWqkyOq7QihkgawdtJxO8B4nCjRGdU98b3aqds iaSMi97UvIgpAYEFmZvhpaC3WfGIW8QxVTkXUmkyF1elLPD6gQVAEWlxkW2VC9bjQZqI pWxxQR6Run3VMj1U+joFjntrudi7MjP067DpYb5EL6DAr3alrb/DHClbDJLqdtYEVzDz S7tQ== 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=pvqyemKU409q4RdvR4LnbGo0yAdbFPnALE0Z2BjpZPA=; b=BeAODi3SIPZhTPYjazTS9uLPmFI3CJ4exS8lZcO7IMXFne5fkpZOkJCwjOU+g743BF ZkHKS9MpglGekiRoa1Z1Nb7soSTutDSjsBu/foe/LbXnLx+227hjN8uCl9XaPG/5hMXE nAJ+iYLx5U0IWYHgyx7qjmdYSW2fvZfmvsXJ6WC+NLgPM+enondLShHSg+F8xzcrpOF3 TpzVlhsCjIso7rH7HSdQp+XYd0fibn61PbL595cLJsX7ARKlk2EjHA8yr++YQMh/A9rB UkD9LKSf68wuhzNwI5yWD/CES8ScXD8kpI13Xky1jZ1aFtfVPYWz+nqLk2/Xaa7r9Fci Pc4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=smiB4Wp1; 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 r4-20020a056214212400b004c791803422si4753210qvc.5.2023.01.09.04.44.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Jan 2023 04: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=smiB4Wp1; 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 1pEqz4-0000d6-JV; Mon, 09 Jan 2023 07:10: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 1pEqyp-0000UZ-0y for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:20 -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 1pEqyn-000774-De for qemu-devel@nongnu.org; Mon, 09 Jan 2023 07:10:18 -0500 Received: by mail-wm1-x333.google.com with SMTP id bi26-20020a05600c3d9a00b003d3404a89faso6827933wmb.1 for ; Mon, 09 Jan 2023 04:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pvqyemKU409q4RdvR4LnbGo0yAdbFPnALE0Z2BjpZPA=; b=smiB4Wp1FoEGvqd0hHv5B9HuqOAAwVOeF4O6Dvc/Abdx4nMltVpz0tYFN3pzwuo5jQ W0FFABt5Utn+bq+47ItTS3x3Z0UVYic7iPZ/fJE5P4BfLTxxaW0M/iIJovoHneHxfK6Y ZmEXbcA8XYONJiXy//DyEsriafDz2omiuiGUu/1nCtQzHys53uE9wQTccaWVz9e2f7Hi etAtrztaoY5naqlnWLvULO1tmnKVzjq4nok3AvtB5FfLdxuIM+xoVAOqAMhasO6Wooa/ dJ3/9jeSCggWvitHXc3Hk+VaNHx9N0JzhWJ8HNfX06baqSlShvjf8Bdpb7z3DE+GaNJ5 Mkew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pvqyemKU409q4RdvR4LnbGo0yAdbFPnALE0Z2BjpZPA=; b=RJA40aCa5jZWc2cPguiBgzJoGl/FSVe4Kmx/rqHerjd5oZJxrAXbWCKTFVkkXeXrSY Mb+cmlBy7QAfG5F6zE49KRxgLKmvzHmZJjb5mXV4gk+uIoA2UV8G2As19U57n1uHuJiP Mou5Ky1piv4r5/aAk567/Q/kBmWk0TFvpaul3MXYF3z8PoSmMVQmbRRbkeyYs5NCQldc 9BAiajzVxLhcRwKuEg2Fg3++s4RU0U60Svr9Sth9HfG20pCXetcwBC3dCGd/9O7lOej2 rjXxAGYn+TxB4Yk8mxvHd6k8gOcND4fT3sYreTwHsHWDNQON4W5T3Bw5TS4bZBNWsbsd FI7A== X-Gm-Message-State: AFqh2koCNxBSTisjhe8R9kW5M2aaJYcE7yhtR9QF5J1ZEIcCN7W28pEh TAO/ZKjI9Azkl+0Rd+8bJNeI1VL6/6NLXAMn X-Received: by 2002:a05:600c:5405:b0:3d9:ef75:ea6e with SMTP id he5-20020a05600c540500b003d9ef75ea6emr2507566wmb.38.1673266215960; Mon, 09 Jan 2023 04:10:15 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id e18-20020a05600c4e5200b003d9876aa04asm13352736wmq.41.2023.01.09.04.10.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Jan 2023 04:10:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bin Meng Subject: [PATCH v2 21/21] hw/block: Make PFlashCFI01 QOM declaration internal Date: Mon, 9 Jan 2023 13:08:33 +0100 Message-Id: <20230109120833.3330-22-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230109120833.3330-1-philmd@linaro.org> References: <20230109120833.3330-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 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 Convert the QOM PFlashCFI01 to a forward/opaque pointer declaration. Only pflash_cfi01.c is able to poke at the internal fields. Reviewed-by: Bin Meng Signed-off-by: Philippe Mathieu-Daudé --- hw/block/pflash_cfi01.c | 2 ++ include/hw/block/flash.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 4e74c9e0d9..56f81d3f2c 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -59,6 +59,8 @@ #define PFLASH_BE 0 #define PFLASH_SECURE 1 +OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI01, PFLASH_CFI01) + struct PFlashCFI01 { /*< private >*/ SysBusDevice parent_obj; diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index 20e5424525..3b7c40afb0 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -8,8 +8,6 @@ #define TYPE_PFLASH_CFI01 "cfi.pflash01" #define TYPE_PFLASH_CFI02 "cfi.pflash02" -OBJECT_DECLARE_SIMPLE_TYPE(PFlashCFI01, PFLASH_CFI01) - BlockBackend *pflash_cfi01_get_blk(DeviceState *dev); MemoryRegion *pflash_cfi01_get_memory(DeviceState *dev);