From patchwork Mon Nov 25 14:05:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 845322 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp1198388wru; Mon, 25 Nov 2024 06:08:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVf1BB+AqELLMn2Oq3qTxoAm99f5if1pa80ZQREDwosDuCfOJWUAb/7GEmBPAMR2z7U/HKmPA==@linaro.org X-Google-Smtp-Source: AGHT+IH41gEFj9L+qAcGal+Z7eRdVW+o09iHySLszHE/TEjxrJZHFBRoWx9gUrCZTYS5RgyfJePU X-Received: by 2002:a5d:6487:0:b0:382:4b69:9ca4 with SMTP id ffacd0b85a97d-3826060d08cmr9526681f8f.26.1732543731363; Mon, 25 Nov 2024 06:08:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732543731; cv=none; d=google.com; s=arc-20240605; b=D0YeqU7mCwiNaYkeOon92G0L5z5mU2U0z4KeNMutEYJ7qDMdjkSKxCBZ+rV7SKLDN8 dWLENXi+Lz1HRdOoEdulJ4yvvOSEpmrkpvGWdefg8fYsHNYWIlfO/J2QNFEwd0I6gKeh gb98K0VmsDXF4t8ifUmuSjnUjttIigem3VGnaaK8QtJtwbOSQG9EV30sNQgpBr5jG9ht vRKM/fGKOy6uk+UfEW+C9N+Ned/s7f5La7X1q5uQ0Wndhs2iEVLV6pOwhmHvsqpFcb9i Rwu/bfLRT6k1Th+W4/QL8E/hRYzxhofzxzo3DbhLczd3wxpzVw4woJ8O/ptlgVEqbxQI JYVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=nwOFcDol4u8ZIeIm4VbuTBCsXEbth7QSSqvQY7JvfPk=; fh=01MTBs686u0z/v+1HBxc617dy4wgnTfT5lmRb9hvZO0=; b=NOvzFQFGc81tfsxxlHbkQNSUn2ZWFVSoDHJyUmW8IeMOYWwZ75ahgnGR1AM10kTuee EpDTMfdCCupEzkBUoygVMsTQEsRFX9fnQz7XK1NOclVGV1Kxd8QQLChtamMYquTVpXdD l5KZ+pb55WzErfGeoqhib7Ia2SsjMbFlxxqfjE4qwT36rVOWn7ZXeO+syq8R3CUy0VIq V3Xqyc5Htruqbl8fHwIeP9+NssesOmtyBy6acDJSoovapMxPxq0lYCRSz8CjpiubVBgO fvUMM6dPmPDdG/YqBT2YJPkjJxAuehCFAa+lyQedmuLF83grIEvCKxpVjV0S9Og+0XTm GHIA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r8cgP8li; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-385be98ddaesi252569f8f.564.2024.11.25.06.08.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Nov 2024 06:08:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r8cgP8li; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tFZkH-0002vq-Lz; Mon, 25 Nov 2024 09:07:21 -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 1tFZjp-0002Xq-OL for qemu-devel@nongnu.org; Mon, 25 Nov 2024 09:06:53 -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 1tFZjn-0006dW-2m for qemu-devel@nongnu.org; Mon, 25 Nov 2024 09:06:53 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-434a1833367so3479915e9.1 for ; Mon, 25 Nov 2024 06:06:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732543609; x=1733148409; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nwOFcDol4u8ZIeIm4VbuTBCsXEbth7QSSqvQY7JvfPk=; b=r8cgP8liI7HuD70/D/hzuwcvXQPS7oGNmwLaDP91pLh0Bn80692c7KOjKppwpTMGs1 ebJ2xVOJfr3mBavOHbh/CvRZvIOVJ8oPj1a1nPLuQBKvujf/8FYim22XGfN2p4w9rioW 9kiks7lxf8ZYosa2UjwB21r9JeDuPNzEvBJxUzlz3pvHUg3nNSszWx+fMiZIlG2gnVEo 9qGqJP0EIFPE+dSMhVhVEH2K3P3lcbCyTPXXYFAEdl2zynSNqJMGBasH9Fh1ULWwPv26 SZ/Glw000ixHmGOsyPQgWwTcJQn6wpdvWj8LDy+HXZRBSuE3fW/24TrBSJAx727fRDxs 8Oww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732543609; x=1733148409; 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=nwOFcDol4u8ZIeIm4VbuTBCsXEbth7QSSqvQY7JvfPk=; b=XPQdcyGHGUlNhJEoqondvTZ/CvswrVesWpnAtHSpa8z5/64E/cc8Z5nMv4VRCWlsmh wUbiyz6tsfvkd7FViH6sz3Fpf4SVByzgV6yBLbqOHvoT06vmus4mdzuRuer0iRocujgz kp9Tsp+UrdROUFxdd2SK2ryujQLSZlS+9Uer3NvJusHTGurZSaQN9sWUCssFm6Z+CXoc EyvFKANFGDfnY1ddlU6jOJT2+PDE2QpVE6Izj23o/y8IuJjXhM1Y0M8SBeU3L58pI4Lh WtgPpefPB0TaGi6CGVQJmZY1hnYIqi5uy5ZQkBgCv6gzw7n+NEjZG03TuBDn1d16m8xP 8pSQ== X-Gm-Message-State: AOJu0YwxdWRd4klN81ZKGuQOkXHquetxpJIrW01CXBeFsW9Yew6w9evd Zr5i0KxHOZdqmk7wyRvjyPaxkE1G6zWyb7RVN+JXtp5ghmCkdmZbEWb8b5BjxEDaNUKEgmkwZav s X-Gm-Gg: ASbGncvI14r6OE10xeTJ3tW0ej1UL5pDGn4y2bwFc+K1pbTCjTtZjP4RevkO+gWWZk3 gIt51hj2xGJO307eeK9NGSVoNziNXUHUk0vTcdSp5ZXowDSlLmFMMlJBrrWczngqxRCKyySmFUC Lmon7zohSXJspoCioTtNpurLtfsobu9JQSAv1L8Yx/M/tu1wYk5WrSCri4XO6vpx1Mf+Q6LrRa8 TPkifLY1MdOzVwtOMwcpBwBoZLvgKBShOEP7FmtO8jlmWNFqr2oTonzpEbtMsPX3uQWTV0v X-Received: by 2002:a05:600c:3b27:b0:431:9340:77e0 with SMTP id 5b1f17b1804b1-433cdb0b3b6mr102923075e9.9.1732543599641; Mon, 25 Nov 2024 06:06:39 -0800 (PST) Received: from localhost.localdomain ([176.176.170.239]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433b45d40basm199474065e9.21.2024.11.25.06.06.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 25 Nov 2024 06:06:31 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Marcin Juszkiewicz , Bin Meng , Alistair Francis , Harsh Prateek Bora , Zhao Liu , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Daniel Henrique Barboza , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= , Liu Zhiwei , Palmer Dabbelt , Marcel Apfelbaum , qemu-arm@nongnu.org, "Michael S. Tsirkin" , Nicholas Piggin , Leif Lindholm , Peter Maydell , qemu-riscv@nongnu.org, Weiwei Li , Radoslaw Biernacki , Thomas Huth , Yanan Wang , Eduardo Habkost , qemu-ppc@nongnu.org Subject: [PATCH-for-10.0 3/8] hw/pci-host/gpex: Allow machines to set PCI_BUS_IO_ADDR0_ALLOWED flag Date: Mon, 25 Nov 2024 15:05:30 +0100 Message-ID: <20241125140535.4526-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241125140535.4526-1-philmd@linaro.org> References: <20241125140535.4526-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=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 Expose the "allow-io-addr0-accesses" property so machines using a GPEX host bridge can set this flag on the bus. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/pci-host/gpex.h | 1 + hw/pci-host/gpex.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h index dce883573b..8c990bff5f 100644 --- a/include/hw/pci-host/gpex.h +++ b/include/hw/pci-host/gpex.h @@ -64,6 +64,7 @@ struct GPEXHost { int irq_num[GPEX_NUM_IRQS]; bool allow_unmapped_accesses; + bool allow_io_addr0_accesses; struct GPEXConfig gpex_cfg; }; diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c index e9cf455bf5..635467016f 100644 --- a/hw/pci-host/gpex.c +++ b/hw/pci-host/gpex.c @@ -32,6 +32,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/irq.h" +#include "hw/pci/pci_bus.h" #include "hw/pci-host/gpex.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" @@ -136,6 +137,9 @@ static void gpex_host_realize(DeviceState *dev, Error **errp) pci->bus = pci_register_root_bus(dev, "pcie.0", gpex_set_irq, pci_swizzle_map_irq_fn, s, &s->io_mmio, &s->io_ioport, 0, 4, TYPE_PCIE_BUS); + if (s->allow_io_addr0_accesses) { + pci->bus->flags |= PCI_BUS_IO_ADDR0_ALLOWED; + } pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq); qdev_realize(DEVICE(&s->gpex_root), BUS(pci->bus), &error_fatal); @@ -154,6 +158,8 @@ static Property gpex_host_properties[] = { */ DEFINE_PROP_BOOL("allow-unmapped-accesses", GPEXHost, allow_unmapped_accesses, true), + DEFINE_PROP_BOOL("allow-io-addr0-accesses", GPEXHost, + allow_io_addr0_accesses, false), DEFINE_PROP_UINT64(PCI_HOST_ECAM_BASE, GPEXHost, gpex_cfg.ecam.base, 0), DEFINE_PROP_SIZE(PCI_HOST_ECAM_SIZE, GPEXHost, gpex_cfg.ecam.size, 0), DEFINE_PROP_UINT64(PCI_HOST_PIO_BASE, GPEXHost, gpex_cfg.pio.base, 0),