From patchwork Thu Nov 2 10:05:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 740441 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp738381wrv; Thu, 2 Nov 2023 03:08:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnOsKc6RLEPvYGQ50dEsfLT9Vefh/1dzkorW0u7xrdhMbdgMP+c/cpkML0GXKgYCwdvo8k X-Received: by 2002:ac8:5951:0:b0:41e:1d17:4ca1 with SMTP id 17-20020ac85951000000b0041e1d174ca1mr19870828qtz.67.1698919712203; Thu, 02 Nov 2023 03:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698919712; cv=none; d=google.com; s=arc-20160816; b=OcjM3zRUKVEKuGJ8KHb74yQ13TNozz2Af650t5EHrphu9Qle9M7a1OB49fyeDZKayU geFPlD50Z7vaXEM/O+obFQXfM9YiLsNDHK0ttgcnzFaCN3eUWkVDk7bIlsl545NX7jEy nZKn5+uquRfjt0Np/IrY+a+i886CTwCKECZ+dJppmszH0oMA15bBsexZIcTp3nTVcruz +bT9Ik3G+n4IcfSjAvCSpK/6ugpas4JE4sPLf59nGoemd/2ttO6kF43q5ZsP+G5ohrWc Sj6p6kPm4hvGEM6OSKTjA957J1jgVpr02DmlUXdd5LkJn0oh9mbFetMKB/5AjB81JGXQ gF8Q== 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; bh=HHTnDGBwSfNOPSScc4QpqW/YOvwGN4xwgsL/sR4G1s0=; fh=iCN9tuTwM5rayWWWJtHoGNfuTLfrQgz//t8J35Hw7Ts=; b=g2yA00WFsEB1mXFH+txnHUQCsJ2wXWAak5zTd+Re6zV3owN53p3pIU0TCtLD4yr9Bs 3V4n51+WnD9W47zxQdkghaElYnTftI0DKilZfdNzA96fwr/gd62djDTJQ9MrklPFHHnC lWgINCcM/w+7EnxqbQqlFouWCpVRM3cu1tUnjLTcxLZuMApuMSKmbD4U9lQ2uWfis1AW TB3USSYVvZQH8HwOguxvwQ55EnORAliUx6pnZMidlnQdp9fcU247TRulR9xe3Gwsdpae DeR9CAUpHST49F1gWK04G8PXUVWZ2N9rW4rRp6r5YAxZbK7IvGenEenw226gBjo/MV2A tUrw== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b12-20020ac87fcc000000b004035b30ed1bsi4236240qtk.589.2023.11.02.03.08.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Nov 2023 03:08:32 -0700 (PDT) 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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyUaM-0001ns-4h; Thu, 02 Nov 2023 06:05:58 -0400 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 1qyUaK-0001n7-RY for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:56 -0400 Received: from mail-ej1-f43.google.com ([209.85.218.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyUaJ-0003G6-CB for qemu-devel@nongnu.org; Thu, 02 Nov 2023 06:05:56 -0400 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-9d274222b5dso113710966b.3 for ; Thu, 02 Nov 2023 03:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698919554; x=1699524354; 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=HHTnDGBwSfNOPSScc4QpqW/YOvwGN4xwgsL/sR4G1s0=; b=GTOU9+B5K6gI8OOjDpK21RGIySp6dHrry34g2BLZzrWvywghh1st0hLYabTRhbQ4zl ro7QTh3war/dLA0PyLfmQRJ+no2QJkIteC21y0yDmEFOcstofxvpQVA92bI+UsZh/BYm K1Fl9vOPBK5fmiFlm7CM3wIeQlhjJuzLno5KnP/EaSUmFX6ZOimjelitBCGUzeRbGGnf QkpOWvoKTstEuAsDp5OtitX11nDFTUCq0uG5BfW3VaMjm8qG5PBPFfkNWUAAas0r8cpl baR+EWZieHpBFohMDStzdFGmy6sEPJqVoERw/9ebtR9KfnyyIpByHoqZsq5xzBDXZNzw FwoQ== X-Gm-Message-State: AOJu0YwLJH3PFXH0M3n3ASOfBi0FLWz32qBRgyVt8tiHQpZ2PEjq2cbM ee4Bi/brWpfziUxwhNf4IKw2Fz0liBo= X-Received: by 2002:a17:907:3601:b0:9c6:c987:4434 with SMTP id bk1-20020a170907360100b009c6c9874434mr3536547ejc.45.1698919553890; Thu, 02 Nov 2023 03:05:53 -0700 (PDT) Received: from localhost.localdomain (ip-109-42-115-39.web.vodafone.de. [109.42.115.39]) by smtp.gmail.com with ESMTPSA id o21-20020a170906359500b009b97d9ae329sm927236ejb.198.2023.11.02.03.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 03:05:53 -0700 (PDT) From: Thomas Huth To: qemu-devel@nongnu.org, Stefan Hajnoczi Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 03/10] hw/m68k/mcf_intc: Expose MMIO region via SysBus API Date: Thu, 2 Nov 2023 11:05:36 +0100 Message-ID: <20231102100543.4875-4-huth@tuxfamily.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231102100543.4875-1-huth@tuxfamily.org> References: <20231102100543.4875-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.218.43; envelope-from=th.huth@gmail.com; helo=mail-ej1-f43.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé QOM objects shouldn't access each other internals fields except using the QOM API. Here the caller of mcf_intc_init() access the MMIO region from the MCF_INTC state. Avoid that by exposing that region via sysbus_init_mmio(), then get it with sysbus_mmio_get_region(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Tested-by: Thomas Huth Reviewed-by: Thomas Huth Message-ID: <20231024083010.12453-4-philmd@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/mcf_intc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/m68k/mcf_intc.c b/hw/m68k/mcf_intc.c index 4cd30188c0..1f74ea0e14 100644 --- a/hw/m68k/mcf_intc.c +++ b/hw/m68k/mcf_intc.c @@ -173,6 +173,7 @@ static void mcf_intc_instance_init(Object *obj) mcf_intc_state *s = MCF_INTC(obj); memory_region_init_io(&s->iomem, obj, &mcf_intc_ops, s, "mcf", 0x100); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); } static void mcf_intc_class_init(ObjectClass *oc, void *data) @@ -211,7 +212,8 @@ qemu_irq *mcf_intc_init(MemoryRegion *sysmem, s = MCF_INTC(dev); s->cpu = cpu; - memory_region_add_subregion(sysmem, base, &s->iomem); + memory_region_add_subregion(sysmem, base, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0)); return qemu_allocate_irqs(mcf_intc_set_irq, s, 64); }