From nobody Sat Dec 21 15:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727195074; cv=none; d=zohomail.com; s=zohoarc; b=CXof+wNw+gj7sQdIe3k808cbIv8urRLCyYZZx0ix4Lk7qnsBCzu1CtHxEj1Dc0VUe8R4s0MmDgq6+Nd0kHFQHBwaOkH76FewhVvRaNJm3eisIB8Z0yoTIjCfc78V6Gc8PplmlLyaM+jyqGRs822DcNaP2JFK1HsHQKwN5hgpjd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727195074; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HHqFiYd34JBge6EKjvquxYF3ZfNzIdsMHiJwWGrVeAw=; b=jxaqgpNXDfDkh33ZaxvorTVhR6VteFxW6DFOrYjJ3VN8wa4QrdhX2IJNvkY8NSxIg+tHcBhoS1SKfC/Qdb+4flRHVlx/fXUo4be0/LZ3iKddSMlzwEEuD0/Fgw8C395IoeAyn6jTG1ehKuf0A7OXz1cmgRDYARrInC5/fpm/lNk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727195074153104.61832754684269; Tue, 24 Sep 2024 09:24:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.803098.1213528 (Exim 4.92) (envelope-from ) id 1st8Kq-00064g-8N; Tue, 24 Sep 2024 16:24:20 +0000 Received: by outflank-mailman (output) from mailman id 803098.1213528; Tue, 24 Sep 2024 16:24:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8Kq-00064Z-5q; Tue, 24 Sep 2024 16:24:20 +0000 Received: by outflank-mailman (input) for mailman id 803098; Tue, 24 Sep 2024 16:24:18 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8Ko-00063x-T4 for xen-devel@lists.xenproject.org; Tue, 24 Sep 2024 16:24:18 +0000 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [2607:f8b0:4864:20::e2b]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 71f4c5b2-7a91-11ef-a0ba-8be0dac302b0; Tue, 24 Sep 2024 18:24:17 +0200 (CEST) Received: by mail-vs1-xe2b.google.com with SMTP id ada2fe7eead31-49bd27b3507so1688554137.2 for ; Tue, 24 Sep 2024 09:24:18 -0700 (PDT) Received: from gmail.com ([168.243.189.171]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4a15178e4cdsm1023711137.9.2024.09.24.09.24.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 09:24:15 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 71f4c5b2-7a91-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727195056; x=1727799856; darn=lists.xenproject.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=HHqFiYd34JBge6EKjvquxYF3ZfNzIdsMHiJwWGrVeAw=; b=XY/2D85lcl1Cuaumfz7l1B8z6Exw85CRff0Jmo9Rplq1aYgmNQ2syTf9qdh9ZSSxlK M/t76VZ7kfZRxze9LVjbOoVjHb2ihfZgg3eFk1TiqhOWIv1SW5tqRWiE4LUR+d7JALHp kcGVL0rDMNyvPR+onTSTPHAhwsgYFR6KaUu+CwA7YeTPlrubUFx1MfBePPbKt/1jFaqv U87TbKqZbakERbQ7/PNUy7ocVFl1Pgt097iBuAcX78lIkfFQeZUk7V33Tz1czTzMWcwh MMsGrErPSDf8P3BdQ3Wfgeykv/j6dI5PwlwIZ4hVqYetExjqz0r1w320iR8Qy76UmMzJ LhQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727195056; x=1727799856; 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=HHqFiYd34JBge6EKjvquxYF3ZfNzIdsMHiJwWGrVeAw=; b=XPYcXBBpEwgY/hgNDhX8p3pOwM9bffGdm9hZIxPS20t0RPQLhXZPkTWkPg1XxhE9if ZmojOUf58MvQkAAucSMWskCGRNPwG4WlAgA+k7lkg4+60jDX46mNTnHB9SIXFu+t0JYR SKcLZSITiiQ08QTqHlwboFwWg6bBN84PGsFc42BpH1i5M175Qu0xiOuYl8Mr06/71tds UE5UPkibDTFgaIB1IqxPf1pTeAdAAivalw+g3URvmtdWY8efO5LZg2K39Gv7azoj4fua tCZjK6lzqOolZgoMYa/zyCZqLyAtY/06Ge0zN9m2yvkHNo2cSRguuBF5yCjrf72CkEFx /Ygw== X-Gm-Message-State: AOJu0YxJFW2NSMkp/3iVIyRgjyCDMLkaFZPpsR91rdwjGURRcfqTNfcB oXeF0UfPeDFiCAWWhg+4skeMkvRzbMAkj1UW8WB65FPYHO8Loq1Mm6olwcnb X-Google-Smtp-Source: AGHT+IFOadIJyLA3vRoloCeVTGG6IzK5wKQ0L3+f1O4b8Vx9++Gc0LFlRZaf0w4w3DseWR2VvoJoqA== X-Received: by 2002:a05:6102:54a7:b0:498:9c0a:af1a with SMTP id ada2fe7eead31-4a15dc64fa3mr111772137.4.1727195056388; Tue, 24 Sep 2024 09:24:16 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, julien@xen.org, bertrand.marquis@arm.com, michal.orzel@amd.com, Volodymyr_Babchuk@epam.com, dpsmith@apertussolutions.com, edgar.iglesias@amd.com Subject: [PATCH v1 1/6] xen/arm: Decrease size of the 2nd ram bank Date: Tue, 24 Sep 2024 18:23:54 +0200 Message-ID: <20240924162359.1390487-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240924162359.1390487-1-edgar.iglesias@gmail.com> References: <20240924162359.1390487-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727195076162116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" The address range between 4G (32bit) and 1TB (40bit) is fully allocated. There's no more room for devices on ARM systems with 40-bit physicall address width. This decreases the size of the second RAM bank to free up space in preparation for virtio-pci and for future use-cases. In the future we may need to add a third RAM bank in higher address ranges. Signed-off-by: Edgar E. Iglesias --- xen/include/public/arch-arm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index e2412a1747..e19f0251a6 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -491,8 +491,8 @@ typedef uint64_t xen_callback_t; #define GUEST_VPCI_PREFETCH_MEM_ADDR xen_mk_ullong(0x100000000) #define GUEST_VPCI_PREFETCH_MEM_SIZE xen_mk_ullong(0x100000000) =20 -#define GUEST_RAM1_BASE xen_mk_ullong(0x0200000000) /* 1016GB of RAM @ 8= GB */ -#define GUEST_RAM1_SIZE xen_mk_ullong(0xfe00000000) +#define GUEST_RAM1_BASE xen_mk_ullong(0x0200000000) /* 952GB of RAM @ 8G= B */ +#define GUEST_RAM1_SIZE xen_mk_ullong(0xee00000000) =20 #define GUEST_RAM_BASE GUEST_RAM0_BASE /* Lowest RAM address */ /* Largest amount of actual RAM, not including holes */ --=20 2.43.0 From nobody Sat Dec 21 15:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727195078; cv=none; d=zohomail.com; s=zohoarc; b=UMMXESkqoje/VVRwkTDAxdCFrH6S+0o9ZGby2IGIpIJZznHdtGZ9iWK2Tz8F+d7YxGAM3JYkCsNwbkwhfM+Pbmv7yBYeVu6D4MM+SsTgYN/qHo0c60NpGcKU26ZsKvnbhNZ3q6vEIgfxzJ+Qg3qNBhKWNTM5yhQm9y0lw7bWM6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727195078; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=i9CJig1i8u5IsDi36lSzKV6C9GOB2ljlgBS7lSvvQGU=; b=HAPwIYphQH5CRXsteIJtoWx7G3MPA5Riu6aDfidTcdxYrGx9YZ2Y6QCV5nOiZhlq1b2On2PYX4SYoyJ5pwRrfMd/WkVHlDFSBjA84TT553ToDhlwAni/+6nBT2CcRQahP1ikebDnyB1FnHGT4zMxjE9CS02RK5MeWOUSycC74Hw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727195078575335.4083131281051; Tue, 24 Sep 2024 09:24:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.803099.1213539 (Exim 4.92) (envelope-from ) id 1st8Ku-0006Mx-Kg; Tue, 24 Sep 2024 16:24:24 +0000 Received: by outflank-mailman (output) from mailman id 803099.1213539; Tue, 24 Sep 2024 16:24:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8Ku-0006Mq-H8; Tue, 24 Sep 2024 16:24:24 +0000 Received: by outflank-mailman (input) for mailman id 803099; Tue, 24 Sep 2024 16:24:23 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8Kt-0005nz-N9 for xen-devel@lists.xenproject.org; Tue, 24 Sep 2024 16:24:23 +0000 Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [2607:f8b0:4864:20::933]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7477f009-7a91-11ef-99a2-01e77a169b0f; Tue, 24 Sep 2024 18:24:22 +0200 (CEST) Received: by mail-ua1-x933.google.com with SMTP id a1e0cc1a2514c-846c588fa63so1409205241.1 for ; Tue, 24 Sep 2024 09:24:22 -0700 (PDT) Received: from gmail.com ([168.243.189.171]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-505a9f447c9sm1009620e0c.21.2024.09.24.09.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 09:24:19 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7477f009-7a91-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727195060; x=1727799860; darn=lists.xenproject.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=i9CJig1i8u5IsDi36lSzKV6C9GOB2ljlgBS7lSvvQGU=; b=gb/+R+82dRdYoftMajuBcFSzzzRHpPCeCB13Emr50VE0H6cIEFIK0cCQlmlRAX2gDP ZMomO471Iqu1Q6OlIMJmztJCjITbERqf6WPZ03pGoPkC7P6qyyIeCm3+ztlG4vd5BHTZ /GzcoQPmAn/4s2FBnFKyOSUW2JK3S1sA5KDak6Y/M/ZU1aAVz4etBW8LAZHlzmUuDOS/ g+yV8jSQ1KUFZK/B3eW96sk0JZ26h7wGFlP0wrJdxPzYNMjks6YE4/cwHyS2BChIWzwO fMeKwYNaufUW2INNCxS6jFJ0HkTlJZKsk4dI+SwdCuxSq4XKygvwXFeZF0CdWq4GmlSV YeFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727195060; x=1727799860; 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=i9CJig1i8u5IsDi36lSzKV6C9GOB2ljlgBS7lSvvQGU=; b=PjrlD5hOfCaGads2nm98DZ7OATbQkXi7FuoHPTv95CjtLZOyFeQOi58pTkKkRFEco8 Jkq5qTa0kMzvpoPF2UjE5EAPti1OXz08PbnDYB1Rj6cfakT847fiD4rEr69paltgPpQU g9thd+eWlTXxbewKvqzM87bSUTvuR1ztWOFsyKUEDiRQ8ZXxDl5OWZnM+41i7XLShT/H nEyyy6t5Gs6jJ+3jGfwpq1LgaCxHNH5r0S6XpmdGuy744dYrpcE53UlIB2HMD/EN/wqC 25ZfJGW7WfQ+6Xv3s5Yj+nULV7fftTYh0IIe4X4pB26BKEql82qK+IAYN7Q4/bSFayMm F7fw== X-Gm-Message-State: AOJu0Yy50GyoMfMKdX6eR/LCBBGyeiPBsz+/x6Lfk81VFkIw2SyVL9Kz yCmBNclPYod+K+Vsl3HHPDe5nTTZIFDo8P6ECU7sekwabJksAMnS0SKcnvGi X-Google-Smtp-Source: AGHT+IFBD/GEOlq+4MH+47ZnN/yNKHDYkjA993DMIapv0ig7Le6AvtB+avT6gcv4xAEnM3dO6MB/pQ== X-Received: by 2002:a05:6122:31a6:b0:4ef:65b6:f3b5 with SMTP id 71dfb90a1353d-505c20925c6mr55521e0c.10.1727195060313; Tue, 24 Sep 2024 09:24:20 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, julien@xen.org, bertrand.marquis@arm.com, michal.orzel@amd.com, Volodymyr_Babchuk@epam.com, dpsmith@apertussolutions.com, edgar.iglesias@amd.com Subject: [PATCH v1 2/6] xen/arm: Reserve resources for virtio-pci Date: Tue, 24 Sep 2024 18:23:55 +0200 Message-ID: <20240924162359.1390487-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240924162359.1390487-1-edgar.iglesias@gmail.com> References: <20240924162359.1390487-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727195080195116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Reserve memory ranges and interrupt lines for an externally emulated PCI controller (e.g by QEMU) dedicated to hosting Virtio devices and potentially other emulated devices. Signed-off-by: Edgar E. Iglesias --- xen/include/public/arch-arm.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index e19f0251a6..654b827715 100644 --- a/xen/include/public/arch-arm.h +++ b/xen/include/public/arch-arm.h @@ -494,6 +494,20 @@ typedef uint64_t xen_callback_t; #define GUEST_RAM1_BASE xen_mk_ullong(0x0200000000) /* 952GB of RAM @ 8G= B */ #define GUEST_RAM1_SIZE xen_mk_ullong(0xee00000000) =20 +/* Virtio PCI - Ordered by decreasing size to keep things aligned */ +#define GUEST_VIRTIO_PCI_PREFETCH_MEM_TYPE xen_mk_ullong(0x43000000) +#define GUEST_VIRTIO_PCI_PREFETCH_MEM_BASE xen_mk_ullong(0x0f000000000) +#define GUEST_VIRTIO_PCI_PREFETCH_MEM_SIZE xen_mk_ullong(0x100000000) + +#define GUEST_VIRTIO_PCI_ECAM_BASE (GUEST_VIRTIO_PCI_PREFETCH_MEM_BAS= E + \ + GUEST_VIRTIO_PCI_PREFETCH_MEM_SIZ= E) +#define GUEST_VIRTIO_PCI_ECAM_SIZE xen_mk_ullong(0x10000000) + +#define GUEST_VIRTIO_PCI_MEM_TYPE xen_mk_ullong(0x02000000) +#define GUEST_VIRTIO_PCI_MEM_BASE (GUEST_VIRTIO_PCI_ECAM_BASE + \ + GUEST_VIRTIO_PCI_ECAM_SIZE) +#define GUEST_VIRTIO_PCI_MEM_SIZE xen_mk_ullong(0x00002000000) + #define GUEST_RAM_BASE GUEST_RAM0_BASE /* Lowest RAM address */ /* Largest amount of actual RAM, not including holes */ #define GUEST_RAM_MAX (GUEST_RAM0_SIZE + GUEST_RAM1_SIZE) @@ -529,6 +543,9 @@ typedef uint64_t xen_callback_t; #define GUEST_FFA_NOTIF_PEND_INTR_ID 8 #define GUEST_FFA_SCHEDULE_RECV_INTR_ID 9 =20 +#define GUEST_VIRTIO_PCI_SPI_FIRST 44 +#define GUEST_VIRTIO_PCI_SPI_LAST 48 + /* PSCI functions */ #define PSCI_cpu_suspend 0 #define PSCI_cpu_off 1 --=20 2.43.0 From nobody Sat Dec 21 15:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727195082; cv=none; d=zohomail.com; s=zohoarc; b=D6MPfBF5OiQ3HzduuChiqNMfAd16WOAow2jBXPRBlQ0iKpGQy8xpTbVs6mmPyap0S/hLxR1bvGUTWhy9XdJNBz4JxfYnwgCBEpR2VOsf2xL/YS5UAWLsPb/YKbpf/+4hzC7xdRQvwcouSCTV+MFpVubaF7/wuh0dgOuBi4JtmLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727195082; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I1Emyc3BWl2EUF/DtLpoTZ7Li7YQQAezyxPBC0AV7dU=; b=chpm4L3I0qIeHrmiXrhcl358HvVFg7R7fxLJ/hkidsFvppe4lZpdpVFojJ/tZ1n4w4G+DVwV+bu028lnIcU0sbc7GpYNibDRIJ+VDCzJG9tWi3QJcFmwNnRJ4w0aWswDBzjGq09BtNfhhtwILPP/T7spoNTanrtIAVXAVkwzgZ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727195082856683.3415155661494; Tue, 24 Sep 2024 09:24:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.803100.1213549 (Exim 4.92) (envelope-from ) id 1st8Kz-0006kT-S0; Tue, 24 Sep 2024 16:24:29 +0000 Received: by outflank-mailman (output) from mailman id 803100.1213549; Tue, 24 Sep 2024 16:24:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8Kz-0006kK-PM; Tue, 24 Sep 2024 16:24:29 +0000 Received: by outflank-mailman (input) for mailman id 803100; Tue, 24 Sep 2024 16:24:28 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8Ky-00063x-Ez for xen-devel@lists.xenproject.org; Tue, 24 Sep 2024 16:24:28 +0000 Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [2607:f8b0:4864:20::e32]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 77c7bc05-7a91-11ef-a0ba-8be0dac302b0; Tue, 24 Sep 2024 18:24:27 +0200 (CEST) Received: by mail-vs1-xe32.google.com with SMTP id ada2fe7eead31-49bd32f6a11so1965814137.1 for ; Tue, 24 Sep 2024 09:24:27 -0700 (PDT) Received: from gmail.com ([168.243.189.171]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4a15178e3e2sm1015805137.8.2024.09.24.09.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 09:24:24 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 77c7bc05-7a91-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727195066; x=1727799866; darn=lists.xenproject.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=I1Emyc3BWl2EUF/DtLpoTZ7Li7YQQAezyxPBC0AV7dU=; b=E9iDFSivwfKdX7ZqFywpqxtglFsUl2jMLa2mwnHwC4Q03SIywQkCl9qY69ymVWD8E/ z5/jlLhE5nQ42cHw7TzKNWMDMrq0f8LYSx1MYEsgnkJAb0wBR4R2L9Urc3m91gis/xgf lRL7C1ZmWjxYqj2okSfGMaLjDWxCqYTkZOFcS0FcaBJlfShN98zQZm7sa1Hs27R+y5tH BLmAR8FIBeuZCGgOsqbZOFhcQ2a0DYMo3Dc2txBiWDE95WDmJSSb77FKkyufJMXrJRXr z9MfgOSsxkrH5L9KDz7lUqmAX42QhkyHFgskJPxwfHoyscKoQ7XlrL80DYjvDx98I+42 Xvbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727195066; x=1727799866; 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=I1Emyc3BWl2EUF/DtLpoTZ7Li7YQQAezyxPBC0AV7dU=; b=DIAX8ZSxBAxHjw7pI47wz/sgq4LVf0shV//MFXJowsT+ldhmcB0WHoad+UQkfglntl cZxH5SWniSQEYo5lDUPzP0oMY87b7C8uqPx5nZnw+YyhMOnNGkEzn/wqk+UvvnGm4tSD o26OsAFjVz7t5ckdFOe1ki5izT30VwFHq4Afco8FtXXGqQ3oE6lLkUTnxZowPJblp/51 vb+FumbcwulxwLWR+FD9rs3DPIAyubtlXCiuu03X3zSfnXutFbF1oMyh/HTovUakFS3E LicaxpBo1HWkiQ6us7k0/MIq7XXVLKBzJvn6fRlyBP1f1tGp0/JenmYq3lVU0Jv7e8RM 5FIQ== X-Gm-Message-State: AOJu0YxKjtfkNWjFDPsfT6tAEOBapHUuPiGCreRG3PVv9g99/TLi+eSZ RB3SecrfaHKb/s2te7/KyktdEdXxUy/h6XZUK31dSjGNfCRH7m3Mqk5f8zyo X-Google-Smtp-Source: AGHT+IF0kSdttzBy8iaGxdALf2ISdaugQF0Xv1SVfUBNBqBSaPhgtSeV1mmH2MkSc0jggbXr4XzpRw== X-Received: by 2002:a05:6102:c52:b0:493:3cde:e46 with SMTP id ada2fe7eead31-4a15dc8f173mr90496137.13.1727195065934; Tue, 24 Sep 2024 09:24:25 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, julien@xen.org, bertrand.marquis@arm.com, michal.orzel@amd.com, Volodymyr_Babchuk@epam.com, dpsmith@apertussolutions.com, edgar.iglesias@amd.com, Stewart Hildebrand Subject: [PATCH v1 3/6] xen/arm: create dom0less virtio-pci DT node Date: Tue, 24 Sep 2024 18:23:56 +0200 Message-ID: <20240924162359.1390487-4-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240924162359.1390487-1-edgar.iglesias@gmail.com> References: <20240924162359.1390487-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727195084271116600 Content-Type: text/plain; charset="utf-8" From: Stewart Hildebrand When virtio-pci is specified in the dom0less domU properties, create a virtio-pci node in the guest's device tree. Set up an mmio handler with a register for the guest to poll when the backend has connected and virtio-pci bus is ready to be probed. Grant tables may be used by specifying virtio-pci =3D "grants";. [Edgar: Use GPEX PCI INTX interrupt swizzling (from PCI specs). Make grants iommu-map cover the entire PCI bus. Add virtio-pci-ranges to specify memory-map for direct-mapped guests. Document virtio-pci dom0less fdt bindings.] Signed-off-by: Stewart Hildebrand Signed-off-by: Edgar E. Iglesias --- docs/misc/arm/device-tree/booting.txt | 21 +++ xen/arch/arm/dom0less-build.c | 238 ++++++++++++++++++++++++++ xen/arch/arm/include/asm/kernel.h | 15 ++ 3 files changed, 274 insertions(+) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index 3a04f5c57f..82f3bd7026 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -276,6 +276,27 @@ with the following properties: passed through. This option is the default if this property is missing and the user does not provide the device partial device tree for the d= omain. =20 +- virtio-pci + + A string property specifying whether virtio-pci is enabled for the + domain and if grant table mappings should be used. If no value is set + this property is treated as a boolean and the same way as if set to + "enabled". + Possible property values are: + + - "enabled" + Virtio-pci is enabled for the domain. + + - "grants" + Virtio-pci is enabled for the domain and an grants IOMMU node will be + generated in the domains device-tree. + +- virtio-pci-ranges + + An optional array of 6 u32 values specifying the 2 cells base addresse= s of + the ECAM, Memory and Prefetchable-Memory regions for virtio-pci. This = is + useful to avoid memory-map collisions when using direct-mapped guests. + Under the "xen,domain" compatible node, one or more sub-nodes are present for the DomU kernel and ramdisk. =20 diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 09b65e44ae..dab24fa9e2 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -586,6 +586,189 @@ static int __init domain_handle_dtb_bootmodule(struct= domain *d, return res; } =20 +static int __init make_virtio_pci_domU_node(const struct kernel_info *kinf= o) +{ + void *fdt =3D kinfo->fdt; + /* reg is sized to be used for all the needed properties below */ + __be32 reg[(1 + (GUEST_ROOT_ADDRESS_CELLS * 2) + GUEST_ROOT_SIZE_CELLS) + * 2]; + __be32 irq_map[4 * 4 * 8]; + __be32 *cells; + char buf[22]; /* pcie@ + max 16 char address + '\0' */ + int res; + int devfn, intx_pin; + static const char compat[] =3D "pci-host-ecam-generic"; + static const char reg_names[] =3D "ecam"; + + if ( p2m_ipa_bits <=3D 40 ) { + printk("PA bits %d is too small!\nvirtio-pci is only supported " + "on platforms with PA bits > 40\n", p2m_ipa_bits); + return -EINVAL; + } + + snprintf(buf, sizeof(buf), "pcie@%lx", kinfo->virtio_pci.ecam.base); + dt_dprintk("Create virtio-pci node\n"); + res =3D fdt_begin_node(fdt, buf); + if ( res ) + return res; + + res =3D fdt_property(fdt, "compatible", compat, sizeof(compat)); + if ( res ) + return res; + + res =3D fdt_property_string(fdt, "device_type", "pci"); + if ( res ) + return res; + + /* Create reg property */ + cells =3D ®[0]; + dt_child_set_range(&cells, GUEST_ROOT_ADDRESS_CELLS, GUEST_ROOT_SIZE_C= ELLS, + kinfo->virtio_pci.ecam.base, GUEST_VIRTIO_PCI_ECAM_= SIZE); + + res =3D fdt_property(fdt, "reg", reg, + (GUEST_ROOT_ADDRESS_CELLS + + GUEST_ROOT_SIZE_CELLS) * sizeof(*reg)); + if ( res ) + return res; + + res =3D fdt_property(fdt, "reg-names", reg_names, sizeof(reg_names)); + if ( res ) + return res; + + /* Create bus-range property */ + cells =3D ®[0]; + dt_set_cell(&cells, 1, 0); + dt_set_cell(&cells, 1, 0xff); + res =3D fdt_property(fdt, "bus-range", reg, 2 * sizeof(*reg)); + if ( res ) + return res; + + res =3D fdt_property_cell(fdt, "#address-cells", 3); + if ( res ) + return res; + + res =3D fdt_property_cell(fdt, "#size-cells", 2); + if ( res ) + return res; + + res =3D fdt_property_string(fdt, "status", "okay"); + if ( res ) + return res; + + /* + * Create ranges property as: + * <(PCI bitfield) (PCI address) (CPU address) (Size)> + */ + cells =3D ®[0]; + dt_set_cell(&cells, 1, GUEST_VIRTIO_PCI_MEM_TYPE); + dt_set_cell(&cells, GUEST_ROOT_ADDRESS_CELLS, kinfo->virtio_pci.mem.ba= se); + dt_set_cell(&cells, GUEST_ROOT_ADDRESS_CELLS, kinfo->virtio_pci.mem.ba= se); + dt_set_cell(&cells, GUEST_ROOT_SIZE_CELLS, GUEST_VIRTIO_PCI_MEM_SIZE); + dt_set_cell(&cells, 1, GUEST_VIRTIO_PCI_PREFETCH_MEM_TYPE); + dt_set_cell(&cells, GUEST_ROOT_ADDRESS_CELLS, kinfo->virtio_pci.pf_mem= .base); + dt_set_cell(&cells, GUEST_ROOT_ADDRESS_CELLS, kinfo->virtio_pci.pf_mem= .base); + dt_set_cell(&cells, GUEST_ROOT_SIZE_CELLS, GUEST_VIRTIO_PCI_PREFETCH_M= EM_SIZE); + res =3D fdt_property(fdt, "ranges", reg, 14 * sizeof(*reg)); + if ( res ) + return res; + + res =3D fdt_property(fdt, "dma-coherent", "", 0); + if ( res ) + return res; + + res =3D fdt_property_cell(fdt, "#interrupt-cells", 1); + if ( res ) + return res; + + /* + * PCI-to-PCI bridge specification + * 9.1: Interrupt routing. Table 9-1 + * + * the PCI Express Base Specification, Revision 2.1 + * 2.2.8.1: INTx interrupt signaling - Rules + * the Implementation Note + * Table 2-20 + */ + cells =3D &irq_map[0]; + for (devfn =3D 0; devfn <=3D 0x18; devfn +=3D 8) { + for (intx_pin =3D 0; intx_pin < 4; intx_pin++) { + int irq =3D GUEST_VIRTIO_PCI_SPI_FIRST - 32; + irq +=3D ((intx_pin + PCI_SLOT(devfn)) % 4); + + dt_set_cell(&cells, 1, devfn << 8); + dt_set_cell(&cells, 1, 0); + dt_set_cell(&cells, 1, 0); + dt_set_cell(&cells, 1, intx_pin + 1); + dt_set_cell(&cells, 1, kinfo->phandle_gic); + /* 3 GIC cells. */ + dt_set_cell(&cells, 1, 0); + dt_set_cell(&cells, 1, irq); + dt_set_cell(&cells, 1, DT_IRQ_TYPE_LEVEL_HIGH); + } + } + + /* Assert we've sized irq_map correctly. */ + BUG_ON(cells - &irq_map[0] !=3D ARRAY_SIZE(irq_map)); + + res =3D fdt_property(fdt, "interrupt-map", irq_map, sizeof(irq_map)); + if ( res ) + return res; + + cells =3D ®[0]; + dt_set_cell(&cells, 1, cpu_to_be16(PCI_DEVFN(3, 0))); + dt_set_cell(&cells, 1, 0x0); + dt_set_cell(&cells, 1, 0x0); + dt_set_cell(&cells, 1, 0x7); + res =3D fdt_property(fdt, "interrupt-map-mask", reg, 4 * sizeof(*reg)); + if ( res ) + return res; + + if ( kinfo->virtio_pci.mode =3D=3D VIRTIO_PCI_GRANTS ) + { + cells =3D ®[0]; + dt_set_cell(&cells, 1, 0x0); + dt_set_cell(&cells, 1, GUEST_PHANDLE_IOMMU); + dt_set_cell(&cells, 1, 0x0); + dt_set_cell(&cells, 1, 0x10000); + res =3D fdt_property(fdt, "iommu-map", reg, 4 * sizeof(*reg)); + if ( res ) + return res; + } + + res =3D fdt_property_cell(fdt, "linux,pci-domain", 1); + if ( res ) + return res; + + res =3D fdt_end_node(fdt); + if ( res ) + return res; + + if ( kinfo->virtio_pci.mode =3D=3D VIRTIO_PCI_GRANTS ) + { + snprintf(buf, sizeof(buf), "xen_iommu"); + + res =3D fdt_begin_node(fdt, buf); + if ( res ) + return res; + + res =3D fdt_property_string(fdt, "compatible", "xen,grant-dma"); + if ( res ) + return res; + + res =3D fdt_property_cell(fdt, "#iommu-cells", 1); + if ( res ) + return res; + + res =3D fdt_property_cell(fdt, "phandle", GUEST_PHANDLE_IOMMU); + if ( res ) + return res; + + res =3D fdt_end_node(fdt); + } + + return res; +} + /* * The max size for DT is 2MB. However, the generated DT is small (not inc= luding * domU passthrough DT nodes whose size we account separately), 4KB are en= ough @@ -693,6 +876,13 @@ static int __init prepare_dtb_domU(struct domain *d, s= truct kernel_info *kinfo) goto err; } =20 + if ( kinfo->virtio_pci.mode ) + { + ret =3D make_virtio_pci_domU_node(kinfo); + if ( ret ) + goto err; + } + ret =3D fdt_end_node(kinfo->fdt); if ( ret < 0 ) goto err; @@ -744,11 +934,24 @@ static int __init alloc_xenstore_evtchn(struct domain= *d) return 0; } =20 +static u64 combine_u64(u32 v[2]) +{ + u64 v64; + + v64 =3D v[0]; + v64 <<=3D 32; + v64 |=3D v[1]; + return v64; +} + static int __init construct_domU(struct domain *d, const struct dt_device_node *node) { struct kernel_info kinfo =3D KERNEL_INFO_INIT; const char *dom0less_enhanced; + const char *virtio_pci; + /* virtio-pci ECAM, MEM, PF-MEM each carrying 2 x Address cells. */ + u32 virtio_pci_ranges[3 * 2]; int rc; u64 mem; u32 p2m_mem_mb; @@ -779,6 +982,41 @@ static int __init construct_domU(struct domain *d, =20 kinfo.vpl011 =3D dt_property_read_bool(node, "vpl011"); =20 + rc =3D dt_property_read_string(node, "virtio-pci", &virtio_pci); + if ( !rc ) + { + if ( !strcmp(virtio_pci, "enabled") ) + kinfo.virtio_pci.mode =3D VIRTIO_PCI; + else if ( !strcmp(virtio_pci, "grants") ) + kinfo.virtio_pci.mode =3D VIRTIO_PCI_GRANTS; + else + { + printk("Invalid \"virtio-pci\" property value (%s)\n", virtio_= pci); + return -EINVAL; + } + } + else if ( rc =3D=3D -ENODATA ) + { + /* Handle missing property value */ + kinfo.virtio_pci.mode =3D dt_property_read_bool(node, "virtio-pci"= ); + } + + if ( kinfo.virtio_pci.mode !=3D VIRTIO_PCI_NONE ) + { + rc =3D dt_property_read_u32_array(node, "virtio-pci-ranges", + virtio_pci_ranges, + ARRAY_SIZE(virtio_pci_ranges)); + if ( rc =3D=3D 0 ) { + kinfo.virtio_pci.ecam.base =3D combine_u64(&virtio_pci_ranges[= 0]); + kinfo.virtio_pci.mem.base =3D combine_u64(&virtio_pci_ranges[2= ]); + kinfo.virtio_pci.pf_mem.base =3D combine_u64(&virtio_pci_range= s[4]); + } else { + kinfo.virtio_pci.ecam.base =3D GUEST_VIRTIO_PCI_ECAM_BASE; + kinfo.virtio_pci.mem.base =3D GUEST_VIRTIO_PCI_MEM_BASE; + kinfo.virtio_pci.pf_mem.base =3D GUEST_VIRTIO_PCI_PREFETCH_MEM= _BASE; + } + } + rc =3D dt_property_read_string(node, "xen,enhanced", &dom0less_enhance= d); if ( rc =3D=3D -EILSEQ || rc =3D=3D -ENODATA || diff --git a/xen/arch/arm/include/asm/kernel.h b/xen/arch/arm/include/asm/k= ernel.h index 7e6e3c82a4..2dab2ac88f 100644 --- a/xen/arch/arm/include/asm/kernel.h +++ b/xen/arch/arm/include/asm/kernel.h @@ -29,6 +29,13 @@ #define DOM0LESS_XENSTORE BIT(1, U) #define DOM0LESS_ENHANCED (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENST= ORE) =20 +/* virtio-pci types */ +enum virtio_pci_type { + VIRTIO_PCI_NONE, + VIRTIO_PCI, + VIRTIO_PCI_GRANTS, +}; + struct kernel_info { #ifdef CONFIG_ARM_64 enum domain_type type; @@ -62,6 +69,14 @@ struct kernel_info { /* Enable/Disable PV drivers interfaces */ uint16_t dom0less_feature; =20 + struct { + enum virtio_pci_type mode; + struct { + u64 base; + } ecam, mem, pf_mem; + u32 pci_intx_irq_base; + } virtio_pci; + /* GIC phandle */ uint32_t phandle_gic; =20 --=20 2.43.0 From nobody Sat Dec 21 15:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727195098; cv=none; d=zohomail.com; s=zohoarc; b=f+oaOGdf8p7Ov/XodKMqGIQuIYuI1d351YhF4xoVGRY41/wLwzV4SKUPDcPRD5SJtILbM/wx+i5TSAqNbv77/kBnXD0YcjE/P1i5v3knJJq6khyE5NeotdL9SRHXeEim45hXinWZMeOeq1uM1Ylq41KBK91KbqSmbZ0sUGVM/H4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727195098; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OruaAEFhBMQDA4a5iLLJKMhZYEY7GZkxUS8+VDnr6Do=; b=ZvvDaq1oztrWWtPGEGK2oLrGjExgVnsJnL+g033PGOkrWL8Q+yqVCkIYANDTh47UA5hSBf79OPTLo228WXH6VN+ub1vInloyIeW8pk+OIPonxJFp6q+0q9/EgtZFTNwz5Rk1wbWaJHjMeIPXGq5k5euLVZmQ44+PIoWMeYJ08Tc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727195098817105.16247577438276; Tue, 24 Sep 2024 09:24:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.803106.1213559 (Exim 4.92) (envelope-from ) id 1st8LD-0007Us-46; Tue, 24 Sep 2024 16:24:43 +0000 Received: by outflank-mailman (output) from mailman id 803106.1213559; Tue, 24 Sep 2024 16:24:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8LD-0007Ul-0x; Tue, 24 Sep 2024 16:24:43 +0000 Received: by outflank-mailman (input) for mailman id 803106; Tue, 24 Sep 2024 16:24:41 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8LA-0005nz-Vp for xen-devel@lists.xenproject.org; Tue, 24 Sep 2024 16:24:40 +0000 Received: from mail-ua1-x92b.google.com (mail-ua1-x92b.google.com [2607:f8b0:4864:20::92b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7ec0c3f4-7a91-11ef-99a2-01e77a169b0f; Tue, 24 Sep 2024 18:24:39 +0200 (CEST) Received: by mail-ua1-x92b.google.com with SMTP id a1e0cc1a2514c-846bcf3677dso1738448241.1 for ; Tue, 24 Sep 2024 09:24:39 -0700 (PDT) Received: from gmail.com ([168.243.189.171]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-505a9f3ef5dsm1004934e0c.13.2024.09.24.09.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 09:24:35 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7ec0c3f4-7a91-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727195077; x=1727799877; darn=lists.xenproject.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=OruaAEFhBMQDA4a5iLLJKMhZYEY7GZkxUS8+VDnr6Do=; b=PEHX5sNyIT9AAcjvo0tIDxjek1xGAMmcRrX+br8UJhzZb/ioZOPOl++JN6JdsiYNRA lAHipP24xH5UP9O68HHaolQkDzf3Oj/KskgO+huTwcTiMI0/SV9In7SFXMMNs4LLyIHG G/yWQ4Gr44rL4McQmbiG0W9hjCEZ/XF4+xFzq4s5JrwY0f6dcIK3YGh+HEirY8t27jJm J10kCXs84IfD6YbM1E7AKsuf8lcN24fTEBd45SW8OAPBOpTQHHGtOHPX9kYuP0m0B+qV vieQkkuoWuawDXHvXnERZ+JRbxJtp69I7aniqeGDWgGWqcr7ATLTqaIet7oCdnjfucV7 SaJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727195077; x=1727799877; 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=OruaAEFhBMQDA4a5iLLJKMhZYEY7GZkxUS8+VDnr6Do=; b=A75V3FOVI4gjrznAwC0hWXKA7ic1973XNzdoafc+kX5bLRLprHLLtkAKuUZp7IIhlz LY1DG+k17eqMdYHDYG5s6t5igVxaHLEuDKoMpRD6Jtu3mmvOmidPY9u8+ImBy0FanOBh 6aJINgQXxrZlJh1Un9BTRY3ExZcny6JDQY3iF4xB909nLqavDwMmFG7LThV0VCV7bpsW DOh1JL2L+XrwdoxS+jyShBh31IOWFkiwUaPwIpFpYyxlOlV1K81yXlE1l8gNGFj96klD vXc4EGHpbFwVmZ9xCJ3nFvRIgXEBFwlFIUqRqKv6CChgJnoaZRfhCX/hO7lqWX/N9Cws Y78A== X-Gm-Message-State: AOJu0YzAs+24TzIxBls/6GXAG7TLZxC0gvOgfBn7bdQbadeWnCbYJ//J B7jPKYjUHjLoMT6rpshiFQwoVwspRnM08sDxgqxgKfSBmHb3VDSzmFgzF/WC X-Google-Smtp-Source: AGHT+IF1mRdmv0tKI3wG2Qd4pOBERiQOFk3OIhRXEWtv21RYXXQ6DCRFbQVyydxhF8cBo0RYjsfQ2w== X-Received: by 2002:a05:6122:2001:b0:4ed:145:348f with SMTP id 71dfb90a1353d-505c20c9250mr43780e0c.12.1727195076637; Tue, 24 Sep 2024 09:24:36 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, julien@xen.org, bertrand.marquis@arm.com, michal.orzel@amd.com, Volodymyr_Babchuk@epam.com, dpsmith@apertussolutions.com, edgar.iglesias@amd.com Subject: [PATCH v1 4/6] xen/arm: io: Add support for mmio background regions Date: Tue, 24 Sep 2024 18:23:57 +0200 Message-ID: <20240924162359.1390487-5-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240924162359.1390487-1-edgar.iglesias@gmail.com> References: <20240924162359.1390487-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727195100303116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add support for mmio background regions. These regions can be overlayed by IOREQ handlers and thus act as fallback handlers while IOREQ clients haven't registered. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- xen/arch/arm/include/asm/mmio.h | 11 ++++++++++- xen/arch/arm/io.c | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/include/asm/mmio.h b/xen/arch/arm/include/asm/mmi= o.h index b22cfdac5b..7da542cd79 100644 --- a/xen/arch/arm/include/asm/mmio.h +++ b/xen/arch/arm/include/asm/mmio.h @@ -70,6 +70,7 @@ struct mmio_handler_ops { struct mmio_handler { paddr_t addr; paddr_t size; + bool background; const struct mmio_handler_ops *ops; void *priv; }; @@ -83,9 +84,17 @@ struct vmmio { =20 enum io_state try_handle_mmio(struct cpu_user_regs *regs, mmio_info_t *info); +void register_mmio_bg_handler(struct domain *d, + bool background, + const struct mmio_handler_ops *ops, + paddr_t addr, paddr_t size, void *priv); +static inline void register_mmio_handler(struct domain *d, const struct mmio_handler_ops *ops, - paddr_t addr, paddr_t size, void *priv); + paddr_t addr, paddr_t size, void *priv) +{ + register_mmio_bg_handler(d, false, ops, addr, size, priv); +} int domain_io_init(struct domain *d, unsigned int max_count); void domain_io_free(struct domain *d); =20 diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c index 96c740d563..934a2ad2b9 100644 --- a/xen/arch/arm/io.c +++ b/xen/arch/arm/io.c @@ -159,6 +159,7 @@ enum io_state try_handle_mmio(struct cpu_user_regs *reg= s, { struct vcpu *v =3D current; const struct mmio_handler *handler =3D NULL; + bool has_background; int rc; =20 ASSERT(info->dabt.ec =3D=3D HSR_EC_DATA_ABORT_LOWER_EL); @@ -170,13 +171,16 @@ enum io_state try_handle_mmio(struct cpu_user_regs *r= egs, } =20 handler =3D find_mmio_handler(v->domain, info->gpa); - if ( !handler ) + has_background =3D handler && handler->background; + if ( !handler || has_background ) { rc =3D try_fwd_ioserv(regs, v, info); if ( rc =3D=3D IO_HANDLED ) return handle_ioserv(regs, v); - - return rc; + else if ( !(rc =3D=3D IO_UNHANDLED && has_background) ) { + /* Only return failure if there's no background handler. */ + return rc; + } } =20 /* @@ -197,9 +201,10 @@ enum io_state try_handle_mmio(struct cpu_user_regs *re= gs, return handle_read(handler, v, info); } =20 -void register_mmio_handler(struct domain *d, - const struct mmio_handler_ops *ops, - paddr_t addr, paddr_t size, void *priv) +void register_mmio_bg_handler(struct domain *d, + bool background, + const struct mmio_handler_ops *ops, + paddr_t addr, paddr_t size, void *priv) { struct vmmio *vmmio =3D &d->arch.vmmio; struct mmio_handler *handler; @@ -213,6 +218,7 @@ void register_mmio_handler(struct domain *d, handler->ops =3D ops; handler->addr =3D addr; handler->size =3D size; + handler->background =3D background; handler->priv =3D priv; =20 vmmio->num_entries++; --=20 2.43.0 From nobody Sat Dec 21 15:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727195100; cv=none; d=zohomail.com; s=zohoarc; b=m1NkOKX3gnfepxkqmBXaTC3BPbL9mJJ+YBqw0pKA//ZA+kjk59m18NsN0+7WWpaYsLCFAf06vG7iuMUjduiWG5TQmYJZaj4xpliFFX0U6LIFPZmEpnc0pBWq7+covI2dvIPxNqq+8qXFpEc/V3/uwVKPpG72dWe6LiR87jofW4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727195100; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jmcayURbwLA4fglObLyXfZR4RfFVjxNCGtPf3/Kime4=; b=YhhhjKprpUjMYH5E//VF7Wjn5iBNT/7q5YRfcAeBJ4SmAPQTR8s0vhJeB/s10jqS+vIhftTgllmwwt/ZORfuLmfZ5zhpP6TIrew4iYiDIQnZiq5DhqWt+nX8T3yzNtXmfJb5YNckMK3tnZXRE+SGmYvbqY7Py9NluX1gsYurQX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17271951005253.868756011507685; Tue, 24 Sep 2024 09:25:00 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.803109.1213569 (Exim 4.92) (envelope-from ) id 1st8LF-0007nS-Cf; Tue, 24 Sep 2024 16:24:45 +0000 Received: by outflank-mailman (output) from mailman id 803109.1213569; Tue, 24 Sep 2024 16:24:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8LF-0007nI-96; Tue, 24 Sep 2024 16:24:45 +0000 Received: by outflank-mailman (input) for mailman id 803109; Tue, 24 Sep 2024 16:24:44 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8LE-0005nz-10 for xen-devel@lists.xenproject.org; Tue, 24 Sep 2024 16:24:44 +0000 Received: from mail-vs1-xe31.google.com (mail-vs1-xe31.google.com [2607:f8b0:4864:20::e31]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 80977fbc-7a91-11ef-99a2-01e77a169b0f; Tue, 24 Sep 2024 18:24:42 +0200 (CEST) Received: by mail-vs1-xe31.google.com with SMTP id ada2fe7eead31-49bc44e51bcso1878536137.2 for ; Tue, 24 Sep 2024 09:24:42 -0700 (PDT) Received: from gmail.com ([168.243.189.171]) by smtp.gmail.com with ESMTPSA id ada2fe7eead31-4a1517c0e1asm1003400137.17.2024.09.24.09.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 09:24:40 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 80977fbc-7a91-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727195081; x=1727799881; darn=lists.xenproject.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=jmcayURbwLA4fglObLyXfZR4RfFVjxNCGtPf3/Kime4=; b=ljIA0e47/O/1iIMLfUCWSKFByZuePAOKqAocQC7xBR0dgXcuGByX0LPbztD21ze0Y/ VvLnk0GYXCjC80VY68MjJ16iK9cDxRavQOapHMTD/qiqjYOSBMgUF6+sm9lRRx7n7roV TpwTdbK7opKTh+GpZczBfC6Dvycck2HP9Ljetqkb5bDNfJNEmt5e8V+7SPQrfmkGiZO8 v8BtKkO7qhzmKm6mhraggxfnTTnrlh5JBM9l5UqrZXkfFevDkGBxEwWVzPioKDiad/PK I3dKgjbp0S0piMKvg7XRcndBbmdBXs2rkhz1KrHVHlfqThPn5opcQ37xaV6i7CFni2EO AkDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727195081; x=1727799881; 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=jmcayURbwLA4fglObLyXfZR4RfFVjxNCGtPf3/Kime4=; b=CuSQKb1/bhlcg0bjXZF9uRT/z/b19O4G//7jN9l8bHG8wICb6t4hxkbKESZhIOlTpu w3yH9XRhMfBOIbeNVvGeOIgZh8brD3QdWFHgo7xFGI9DKIixJwT08azINxt7g3FfHUw8 bx12ulqBMULeO/M3oODlnAyMrsgYgxrj7spMbwfPPbTP/DgruRqGxFxvhWU1hxjd3sK/ wWWr3cEb5sfkoroiAvwt+hgTiTlhqHYinNpxCd/YMNVeS/5Q6uz8l4ZAZB/VOcZIwDVL LH7XoIkcd/FeAh7RT+mHAjOLz7OQUfPuGDiXej3Hz6nWzVciLbqR5MiMBce8bwlxmrTW 5L1A== X-Gm-Message-State: AOJu0Yzd/JUpG4/kbi4+xBVJB2In4mjaW//ZYepqBBX9pXQQuwhI9qZ3 z05Qc61u4tqDG4Mx2AD2NKWKOUuWUPQyyXbOvhW7tM3E0eZQzVH74rF3HE2d X-Google-Smtp-Source: AGHT+IHLZSH080iTk+As1JXYiDfxpcGs1Rd+oD5mrht+Y1a4L+lu+7BUt7tkPVi8MQkr+poDU4lhew== X-Received: by 2002:a05:6102:c92:b0:49a:211a:f08d with SMTP id ada2fe7eead31-4a15dd7897amr47661137.24.1727195080731; Tue, 24 Sep 2024 09:24:40 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, julien@xen.org, bertrand.marquis@arm.com, michal.orzel@amd.com, Volodymyr_Babchuk@epam.com, dpsmith@apertussolutions.com, edgar.iglesias@amd.com Subject: [PATCH v1 5/6] xen/arm: io: Add a read-const writes-ignored mmio handler Date: Tue, 24 Sep 2024 18:23:58 +0200 Message-ID: <20240924162359.1390487-6-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240924162359.1390487-1-edgar.iglesias@gmail.com> References: <20240924162359.1390487-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727195102310116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add a read-const writes-ignored mmio handler. This is useful to for example register background regions that return a fixed value instead of raising data aborts. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- xen/arch/arm/include/asm/mmio.h | 2 ++ xen/arch/arm/io.c | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/xen/arch/arm/include/asm/mmio.h b/xen/arch/arm/include/asm/mmi= o.h index 7da542cd79..605620a2f4 100644 --- a/xen/arch/arm/include/asm/mmio.h +++ b/xen/arch/arm/include/asm/mmio.h @@ -82,6 +82,8 @@ struct vmmio { struct mmio_handler *handlers; }; =20 +extern const struct mmio_handler_ops mmio_read_const_writes_ignored; + enum io_state try_handle_mmio(struct cpu_user_regs *regs, mmio_info_t *info); void register_mmio_bg_handler(struct domain *d, diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c index 934a2ad2b9..8ab0435afc 100644 --- a/xen/arch/arm/io.c +++ b/xen/arch/arm/io.c @@ -20,6 +20,27 @@ =20 #include "decode.h" =20 +/* + * Reusable mmio handler useful as background while waiting for IOREQ. + * Register with priv as default read value. Writes ignored. + */ +static int bg_read(struct vcpu *v, mmio_info_t *info, register_t *r, void = *priv) +{ + *r =3D (uintptr_t) priv; + return 1; +} + +static int bg_write(struct vcpu *v, mmio_info_t *info, register_t r, void = *priv) +{ + return 1; +} + +/* Read const value (from priv), writes ignored. */ +const struct mmio_handler_ops mmio_read_const_writes_ignored =3D { + .read =3D bg_read, + .write =3D bg_write, +}; + static enum io_state handle_read(const struct mmio_handler *handler, struct vcpu *v, mmio_info_t *info) --=20 2.43.0 From nobody Sat Dec 21 15:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1727195226; cv=none; d=zohomail.com; s=zohoarc; b=Yp+5hDtO5yF91wzKtlNh4FvMXbYgJPiyetRm1tPlWq6PoTSz7g1AnN6HZ4Ohw7/cuiWo/6lyIuAvLJi7JuUdZZ3K6eWo4NMgKqO6yzD2vD41NHJgAq0871EN8e3ckcdfy0MDR99HrjyLPMgAZt3ZvhGzq519airjbW675SZQN4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727195226; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GLI4kKkgQKzQsFANk7z1TUU4nn0G0MAxu+0mTyaXmA8=; b=jzcKq2P+ToPtIEfT10jTUiWKq88ETNnh1YBdD3MjO2UBhiIlejWlgF/Zs0qn6X9SotAqikvDwHQerE0IntGGIee22pIpxZ0La+X7Z4eW0Jlnfx6OZMhOffrod/mkW+HiDJWlppohEzkCYkqEHDhFcFyTQ4iAvg8bKLZOfKU0adU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1727195226814135.9120791387952; Tue, 24 Sep 2024 09:27:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.803139.1213579 (Exim 4.92) (envelope-from ) id 1st8NG-0001E5-UK; Tue, 24 Sep 2024 16:26:50 +0000 Received: by outflank-mailman (output) from mailman id 803139.1213579; Tue, 24 Sep 2024 16:26:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8NG-0001Dy-QB; Tue, 24 Sep 2024 16:26:50 +0000 Received: by outflank-mailman (input) for mailman id 803139; Tue, 24 Sep 2024 16:26:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1st8LK-0005nz-MG for xen-devel@lists.xenproject.org; Tue, 24 Sep 2024 16:24:50 +0000 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [2607:f8b0:4864:20::b2d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 83bfcb5a-7a91-11ef-99a2-01e77a169b0f; Tue, 24 Sep 2024 18:24:47 +0200 (CEST) Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-e02c4983bfaso5148974276.2 for ; Tue, 24 Sep 2024 09:24:47 -0700 (PDT) Received: from gmail.com ([168.243.189.171]) by smtp.gmail.com with ESMTPSA id 71dfb90a1353d-505a9efb4a3sm1023237e0c.3.2024.09.24.09.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 09:24:45 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 83bfcb5a-7a91-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727195085; x=1727799885; darn=lists.xenproject.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=GLI4kKkgQKzQsFANk7z1TUU4nn0G0MAxu+0mTyaXmA8=; b=XrZn8pxFj/bTqPZk72wgMp6TvsE3r0zT/QoI/IG+ggrJEY0MSXaLLriF4/9vAxX6Qc YDqbikn7E5iYyOfJW5FKajz2Sl5K7N6oKzFFO7BemlxmsdrQ9D/DzhSW5slMTZe0M20i IZScQ2BcD0dKhb8M9SwD5/YPR4rqDh+jb/ncdiKYVQ6IGlt7Htpp9xfsQXsx+hNLA6GD hanvZRfOpxlJrBvrSEjasqlfEDn1+fzFZ8xr/hwg0rspVFU1/VTAMPHJH1KHOTSzWj5t A0HHCq7mnummuVYS4kelF+ga/pNZqZIfkNfHx1Hy8WwjpQViDGPIxHY0/uppV25+Fq+m RGJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727195085; x=1727799885; 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=GLI4kKkgQKzQsFANk7z1TUU4nn0G0MAxu+0mTyaXmA8=; b=Sbps4xGhoelGpCq8dA8aboUTwWqsV2B2HhpRisZC5Qq4/rPDPqHrs9beEp58ouv8o1 a9BVkMKCE0BzaiHdKM4L8H3wyU8gLoau4yGPmBOkTUQ19+bDiAWOVqgRYVOUsEMsnEO5 NtBouRvPRyt/e4qAqoaLNXRph6UCbOArnmneHzoSjKay3sKGxtYyvuHnfbuGJ6ybT06x FPJA+rOVnCVZuswr402DSUx5aR+LSmmqe0GFbRQ4oOt79TfviWGZdDAApPJa9sgC5eIj PMZIMNyBN0x0yZAKpKPCuJYxvC73tnqxwdEO4fxvNjtUcZNGbzY80qCPW3TZI9GqGiEY 6LDw== X-Gm-Message-State: AOJu0YzVEPXSlLRsUyB5m94rvSOVBHWQ/oCJKrQmUZYLS6k9O5Z88e4L MkzOU2LjxkaQPZ9K/+30+nBv97IIAVn5LHhQ98HMIaLXLMvAugDW6AVtZO8o X-Google-Smtp-Source: AGHT+IEYLv6/HzhBlE9NW/AuH+xm6fvDwlR+mdLkGxpus9cOgrYa/DTirHn+Hjd+Cm6b8Ug3fPZB6g== X-Received: by 2002:a25:d856:0:b0:e22:5db2:a947 with SMTP id 3f1490d57ef6-e225db2aa8emr7938369276.34.1727195085555; Tue, 24 Sep 2024 09:24:45 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, julien@xen.org, bertrand.marquis@arm.com, michal.orzel@amd.com, Volodymyr_Babchuk@epam.com, dpsmith@apertussolutions.com, edgar.iglesias@amd.com Subject: [PATCH v1 6/6] xen/arm: dom0less: Add a background PCI ECAM mmio region Date: Tue, 24 Sep 2024 18:23:59 +0200 Message-ID: <20240924162359.1390487-7-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240924162359.1390487-1-edgar.iglesias@gmail.com> References: <20240924162359.1390487-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727195228924116600 Content-Type: text/plain; charset="utf-8" From: "Edgar E. Iglesias" Add a background PCI ECAM mmio region always reading as all ones. This indicates to the OS that there are no PCI devices on the bus. Once the device-model's IOREQ client connects, the OS can rescan the bus and find PV and emulated devices. This avoids a race where domU's come up before the device models, causing domU to crash into a data-abort when accessing ECAM. Signed-off-by: Edgar E. Iglesias Reviewed-by: Stefano Stabellini --- xen/arch/arm/dom0less-build.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index dab24fa9e2..bc5285e7fa 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -1015,6 +1015,16 @@ static int __init construct_domU(struct domain *d, kinfo.virtio_pci.mem.base =3D GUEST_VIRTIO_PCI_MEM_BASE; kinfo.virtio_pci.pf_mem.base =3D GUEST_VIRTIO_PCI_PREFETCH_MEM= _BASE; } + + /* + * Register a background PCI ECAM region returning ~0. This indica= tes + * to the OS that there are no PCI devices on the bus. Once an IOR= EQ + * client connects, the OS can rescan the bus and find devices. + */ + register_mmio_bg_handler(d, true, &mmio_read_const_writes_ignored, + kinfo.virtio_pci.ecam.base, + GUEST_VIRTIO_PCI_ECAM_SIZE, + (void *) ULONG_MAX); } =20 rc =3D dt_property_read_string(node, "xen,enhanced", &dom0less_enhance= d); --=20 2.43.0