From patchwork Wed Jan 4 22:04:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 639043 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp1965387pvb; Wed, 4 Jan 2023 14:19:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXt9yks4NHMp2XT3jQdHG/5XkW3f+/XYaaYf8qNFSnrMMupaKBNaUfefpW1n/4YSvW8EgsBn X-Received: by 2002:ac8:5191:0:b0:3a6:93cf:7dec with SMTP id c17-20020ac85191000000b003a693cf7decmr68369941qtn.48.1672870753291; Wed, 04 Jan 2023 14:19:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672870753; cv=none; d=google.com; s=arc-20160816; b=BU6zu9pq/MoDOiO+hhYcOUdkM1I7AJRIu5BlJ2rrBIVNXmCki8CO3zNAatQOiSqvC6 8sKj5mJwVS98NYzkXzFAQg1vmcgoCcWavRE+Zex12R6LuwPabxxmt4Od2/CuNmWWpiMv 6dgS29MucZKDEFdiPnQmZ6045ZfZ9i+SkOc7n7ENVZyG/uzcTSj4uOqnInljRIDsPM8C 1puV96yCtLjTARI1L24zzD9sy3KG9U3F7g4rKqrfTzcOmpTD4lVtq/n5MsyZwV2dN+Kq b7LFiv/QVCo1rZBuoKrwWKvID7kosxSRSSL6GRkJAW1Y5bQXmhCuXBz0tSnUH+d6upmC EJPA== 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=4Yfck/dkEQ1qiQRqZ2doov1ZobzOuy108Vmk2yEOlvU=; b=NVQr5NsM0c7LJJ22FbYI/zDzH+CMGVcEGfUfIJdzN6HhedGrqh4TxOpiy+IvsDyYE4 gCaDKpMx4vVoL5GAt92WqCpJ5Oc/y0gW9a4geBJSaisAhK+PTnmTMVkvHkDLLb3HXIHU G01vXqSsAAHo3ahw8gzkSsCJZgSqBzohyiXndFqO5HSQ+CyOdj4RcuzSdtbvtw2EDi2V vutwRj21uXeeM6FbqOshQmv3Ndj6J5NaUTif9PjaGCwN+PFk/IgKQolnOyZTCkSzOBcz FdXT8nRo6Kfa/7KG/WYsor6O4YfsmXBSo9ofb4PIHb+yWsPT5QVs89ZSyO4TY0v/bzWk W8oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a2p5k6oB; 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 e4-20020ac86704000000b003a80f072024si17907184qtp.80.2023.01.04.14.19.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jan 2023 14:19:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a2p5k6oB; 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 1pDBtE-0000O6-TE; Wed, 04 Jan 2023 17:05:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDBtC-0000I2-QM for qemu-devel@nongnu.org; Wed, 04 Jan 2023 17:05:38 -0500 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDBtA-0004zZ-V1 for qemu-devel@nongnu.org; Wed, 04 Jan 2023 17:05:38 -0500 Received: by mail-ej1-x629.google.com with SMTP id fy8so21955810ejc.13 for ; Wed, 04 Jan 2023 14:05:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4Yfck/dkEQ1qiQRqZ2doov1ZobzOuy108Vmk2yEOlvU=; b=a2p5k6oBfHIIcb9Uw1m2zAqimXZm+gdGar5jbK8cQ26Amd7fVl7cxi0GM0EIfzCWnd 2AGsY7wwodH2MSr4W0+FfmwTZmKjU3yfjK6bcczpgCG3Pyp99DRqAT7xiZKIy6wsdhNJ nQ23jF+yj00wW66C/4odJ9g8tq8mySZ/lY0Hxxb+vNkz21NA7pCuwoYFqWfygeyRrpec WDCntx851w9pjiA1kKdSmZZFd6M/1VXeUafv7g6C7sTQAePzQ4jbukY5tAOy9Ptdadz7 S6xvuwTIosDwQp9hdJip2cOj4nGKOKLZqCDH0xsW/QiDCxvWJeNvU+svZhCVs2gXZUeb y9+A== 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=4Yfck/dkEQ1qiQRqZ2doov1ZobzOuy108Vmk2yEOlvU=; b=SPQ4HOrPxdiVts4sIr4f64WMADp3RUQ5VDMvqNrskUdylWXPILqP3VTEJnTyMLFU0S QJzCv4hTTnyi/xkIDVG0WRhEkFr/DWaE/Xyhcv/wujoe2kF+sQqy7eUelXKt2XGXTuOt lkLvq74XtN0/+I89ew98hIrrKMzsbm5vhl8POyqr89xhgXCyGQIwY6iKzcy01yr3bIqY hKhqAR1Y41L/2Y44PQofhDgLvU/1od20C/VXvPjDjgeUeIXv2x8gK8s5mLgqXiw7kk0F 3awvTR+iixIXCWPlsAS409/fGHmoNPbss17cnGVdamIjPEfQP5imyX3DfzgRqDGmRVKv 5VYw== X-Gm-Message-State: AFqh2kpkZmNrDBu0f87YlBMw+q5B5dMcNyTJIVMrgS5f2Aqm1PZEhs/+ p+j/V4R0qzXN9//b/24mPVWFlJ0wc7ZlQqBV X-Received: by 2002:a17:907:76cc:b0:842:cd68:4943 with SMTP id kf12-20020a17090776cc00b00842cd684943mr43315948ejc.11.1672869935936; Wed, 04 Jan 2023 14:05:35 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id ue3-20020a170907c68300b0084c7f96d023sm9207905ejc.147.2023.01.04.14.05.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 04 Jan 2023 14:05:35 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Song Gao , Antony Pavlov , Jan Kiszka , Marcel Apfelbaum , Hanna Reitz , Bernhard Beschow , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Paolo Bonzini , qemu-ppc@nongnu.org, Mark Burton , Richard Henderson , Magnus Damm , "Michael S. Tsirkin" , Bin Meng , Max Filippov , Aurelien Jarno , Eduardo Habkost , Palmer Dabbelt , Radoslaw Biernacki , Jiaxun Yang , "Edgar E. Iglesias" , Xiaojuan Yang , Peter Maydell , qemu-block@nongnu.org, qemu-riscv@nongnu.org, Yoshinori Sato , Alistair Francis , qemu-arm@nongnu.org, Leif Lindholm , Kevin Wolf Subject: [PATCH 05/20] hw/loongarch: Use generic DeviceState instead of PFlashCFI01 Date: Wed, 4 Jan 2023 23:04:34 +0100 Message-Id: <20230104220449.41337-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230104220449.41337-1-philmd@linaro.org> References: <20230104220449.41337-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; helo=mail-ej1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 c8a495ea30..cd5aa26f49 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; @@ -899,7 +898,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")