From patchwork Sat Mar 9 19:21:29 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: 13587860 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1ACECC54791 for ; Sat, 9 Mar 2024 19:22:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690968.1076655 (Exim 4.92) (envelope-from ) id 1rj2H9-0000M3-V7; Sat, 09 Mar 2024 19:22:31 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690968.1076655; Sat, 09 Mar 2024 19:22:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2H9-0000Lw-SP; Sat, 09 Mar 2024 19:22:31 +0000 Received: by outflank-mailman (input) for mailman id 690968; Sat, 09 Mar 2024 19:22:30 +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 1rj2H8-0000Lp-A2 for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:22:30 +0000 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [2a00:1450:4864:20::235]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5dcb3ae4-de4a-11ee-a1ee-f123f15fe8a2; Sat, 09 Mar 2024 20:22:27 +0100 (CET) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2d269b2ff48so48590471fa.3 for ; Sat, 09 Mar 2024 11:22:27 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id h27-20020a170906399b00b00a3ce60b003asm1185569eje.176.2024.03.09.11.22.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:22:26 -0800 (PST) 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: 5dcb3ae4-de4a-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012147; x=1710616947; 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=9v68VdV/ZTxTWOB82N2ZE0IksCha8mce59bQC7Dz3io=; b=yEpkwDrDEK9gaMVwUMhBTD2iC76eIDs4c3mmaukr5E31sU94xeMu6QaKLxJfSo2t1j MJxXYh7ad+g/qkJJ2G632FiB2zEeYc9/djsaoD2L6mZDAwcXB1KOiOoMoYXf1lG6qj7F QBVqbi71bp1j5WJYA9bkVYdxuIzXlQ8azJgEIjI6XoLJYlsfb1+o+rMDXK1Ynf4RyNmB RUUmdea/ApF5S8CAx67ZzRuOb+uSy2pPMdTcKVV5B5+QOTWALZBJ1Fm/ER56RUyAE7sk r0qL1Mx7Rb+7AtvtX2jbf7Z85hdvoGVmmpRcwSaJ/ZHX1Fq2eFrcvd4HZmKOFEHeVKmI lpeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012147; x=1710616947; 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=9v68VdV/ZTxTWOB82N2ZE0IksCha8mce59bQC7Dz3io=; b=e6chuYUxQtZjAVvFqDUEObICxKFHeyC/U1b8GXjOGP5BYVqd0VAQ8sFIuU+BY6EcHD /c0rSwOXcm0XWFzbzma1XlU0SrgmhKzqPGKrWd285viywcZCk377ShZ3M9UNA2E9k3JP hAAI8DqjGRvpUGxFj027UOx2hsyO27l1UBC4unA0EKeFx0PqDZpbaqPsIBosiuuU7Rqu ZqG2LR/2dzMxtE+hi+gAAZBR7PwGPJnT2UCGy7XgG3WI7DoOERcZ3P3zBcLoRuAZKLA5 3wlTlhZWLW7InP4j07PcTzHuoJXiSI4l9DX5kTLILqjycRhg2grudI/uaU7DifZNtEVd NV1g== X-Forwarded-Encrypted: i=1; AJvYcCU2pc9OGjGA3nygowsQAUHrmwABysQdyWat600LL82lOF1/SghAzy9IUFRqt224IK6lTU8w9D0XCsMXyL5y2cqTp8L8/uEO9iEcE2HkKKY= X-Gm-Message-State: AOJu0YxeXDDNM4clBePbZtuZ0W5fYCLRA3jvmipHELd1ykNy1/xM11F2 2IGkGqymFu8RoRNK7LXp1gVyhHyFWQ5zjzpElkP5BALBSGM0liwAEN1mdcCx/H0= X-Google-Smtp-Source: AGHT+IEPUeAq3OvXQ6d5BNC7LVFINL5jOukf6dFmDeF5FkUQjdJ+zjK8mwm9i8o+ivn3j1gVM1bH4g== X-Received: by 2002:ac2:43d2:0:b0:513:486a:57af with SMTP id u18-20020ac243d2000000b00513486a57afmr1542144lfl.7.1710012147310; Sat, 09 Mar 2024 11:22:27 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Richard Henderson , David Woodhouse , Stefano Stabellini , Anthony Perard , Paul Durrant , xen-devel@lists.xenproject.org Subject: [PULL 02/43] sysemu/xen: Forbid using Xen headers in user emulation Date: Sat, 9 Mar 2024 20:21:29 +0100 Message-ID: <20240309192213.23420-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 Xen is a system specific accelerator, it makes no sense to include its headers in user emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-3-philmd@linaro.org> --- include/sysemu/xen.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h index bc13ad5692..a9f591f26d 100644 --- a/include/sysemu/xen.h +++ b/include/sysemu/xen.h @@ -10,6 +10,10 @@ #ifndef SYSEMU_XEN_H #define SYSEMU_XEN_H +#ifdef CONFIG_USER_ONLY +#error Cannot include sysemu/xen.h from user emulation +#endif + #include "exec/cpu-common.h" #ifdef NEED_CPU_H @@ -26,16 +30,13 @@ extern bool xen_allowed; #define xen_enabled() (xen_allowed) -#ifndef CONFIG_USER_ONLY void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length); void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, struct MemoryRegion *mr, Error **errp); -#endif #else /* !CONFIG_XEN_IS_POSSIBLE */ #define xen_enabled() 0 -#ifndef CONFIG_USER_ONLY static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) { /* nothing */ @@ -45,7 +46,6 @@ static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, { g_assert_not_reached(); } -#endif #endif /* CONFIG_XEN_IS_POSSIBLE */ From patchwork Sat Mar 9 19:21: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: 13587861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDF90C54E66 for ; Sat, 9 Mar 2024 19:22:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690969.1076665 (Exim 4.92) (envelope-from ) id 1rj2HF-0000ap-6H; Sat, 09 Mar 2024 19:22:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690969.1076665; Sat, 09 Mar 2024 19:22:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2HF-0000ai-3I; Sat, 09 Mar 2024 19:22:37 +0000 Received: by outflank-mailman (input) for mailman id 690969; Sat, 09 Mar 2024 19:22:35 +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 1rj2HD-0000Lp-9w for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:22:35 +0000 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [2a00:1450:4864:20::62d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 614e9094-de4a-11ee-a1ee-f123f15fe8a2; Sat, 09 Mar 2024 20:22:33 +0100 (CET) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a4604c8bd61so45581866b.2 for ; Sat, 09 Mar 2024 11:22:33 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id sd21-20020a170906ce3500b00a45f3524ac3sm1161512ejb.118.2024.03.09.11.22.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:22:32 -0800 (PST) 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: 614e9094-de4a-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012153; x=1710616953; 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=hXABjAaMhxHgVCCn4BlGHy0+qqoq0gDIyiPdTnOnZyc=; b=nPcRDCmZ1T2jOk7q0fXylebJDqvb13cUqGxZo8BL10LZ9daa+9J7fhQQHryzXPF5Pd RrkkvfcbBCXPRecf1+w4QzeupkbIsS+sPcbpdAIHrymO7dnDR57g42qeb3AR5yU8MowN NStnv9KC3DdC4MH3wXlRJj6wtKsAz3+MaEPrP81QRIwmq3MUiKPJSqR/LH+4MqJXXAKN 4fy1cBqw60WkzJW62c5RntSfd1/zaz9j97iesz5BvOjc5+je4wuKAiURoaKserUYf6Wb vsfjYLKONtslnYSgxfbcKNYmJg9T6QXoc65YU+sWfpXdeN+cXJaJBPVuf91iz5BkzS1H Ke5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012153; x=1710616953; 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=hXABjAaMhxHgVCCn4BlGHy0+qqoq0gDIyiPdTnOnZyc=; b=XE7XCw4kYToKSJ0ITTLdBDgxQsWnDFUAE3EFgbn82S6ggjLg2F1p7nn/DiK5Z2Ym5E A/m7j0ulCXZIHN5Py+sJXE4tLgltytgAi9dfm8My5+JA6B+Zkxfhm8AcCDXqOipw2LOR xQg12j1BhbLjceu6NxlKoDfexc+ye234G6xfA0Z9EL3y+X3dzGZ9REXpiteKA7h20VRi 5Sqjay8kjFG5+a3vcsqXRZXLnva+HdGpVQtwKdzwZRK6tmn5Pn79bxhu6A3FjRRrB8qG SneUwLjtqMOBbU6zddixK5p4QhOqr6BKq23ER7dCre8MnkF2lvlHJu8JH1SPyplfjAwP /T5g== X-Forwarded-Encrypted: i=1; AJvYcCVZDG3hcKf2ELc7Qe7KfW40nDAIoFcgaBavtXGWpOzMZnDniCKuCu15ZknfrNFhMjmDjVR90EnbuFSThT4+OUh99GIl49mSR5VnvxB9aZw= X-Gm-Message-State: AOJu0YzlTPJ8ICUre1QqLAwQIF8iLAu6yid/fKm5yWsv5tLwJlu4a6Vi oWEEkNKg2SvdPuuyZ5XnxLsKQwMeJqIxSYSpgqj23di4qmqXTkLN3A4Rre0+f2s= X-Google-Smtp-Source: AGHT+IG1/vyvQGvmM09S/M6+IuzayHPuZieilQc2Rg23/rY/x2WN2KV9nhRWH7snP7zUoE6gG7SZXw== X-Received: by 2002:a17:906:4f02:b0:a44:446b:e99e with SMTP id t2-20020a1709064f0200b00a44446be99emr1256763eju.31.1710012153357; Sat, 09 Mar 2024 11:22:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , David Woodhouse , Stefano Stabellini , Anthony Perard , Paul Durrant , xen-devel@lists.xenproject.org Subject: [PULL 03/43] sysemu/xen-mapcache: Check Xen availability with CONFIG_XEN_IS_POSSIBLE Date: Sat, 9 Mar 2024 20:21:30 +0100 Message-ID: <20240309192213.23420-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 "sysemu/xen.h" defines CONFIG_XEN_IS_POSSIBLE as a target-agnostic version of CONFIG_XEN accelerator. Use it in order to use "sysemu/xen-mapcache.h" in target-agnostic files. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-4-philmd@linaro.org> --- include/sysemu/xen-mapcache.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/sysemu/xen-mapcache.h b/include/sysemu/xen-mapcache.h index c8e7c2f6cf..10c2e3082a 100644 --- a/include/sysemu/xen-mapcache.h +++ b/include/sysemu/xen-mapcache.h @@ -10,10 +10,11 @@ #define XEN_MAPCACHE_H #include "exec/cpu-common.h" +#include "sysemu/xen.h" typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr phys_offset, ram_addr_t size); -#ifdef CONFIG_XEN +#ifdef CONFIG_XEN_IS_POSSIBLE void xen_map_cache_init(phys_offset_to_gaddr_t f, void *opaque); From patchwork Sat Mar 9 19:21:33 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: 13587862 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E0D8C54791 for ; Sat, 9 Mar 2024 19:23:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690970.1076675 (Exim 4.92) (envelope-from ) id 1rj2HW-00010k-Cd; Sat, 09 Mar 2024 19:22:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690970.1076675; Sat, 09 Mar 2024 19:22:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2HW-00010b-A1; Sat, 09 Mar 2024 19:22:54 +0000 Received: by outflank-mailman (input) for mailman id 690970; Sat, 09 Mar 2024 19:22:52 +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 1rj2HU-0000Lp-QP for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:22:52 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6bb07afb-de4a-11ee-a1ee-f123f15fe8a2; Sat, 09 Mar 2024 20:22:51 +0100 (CET) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5683576ea18so1629602a12.3 for ; Sat, 09 Mar 2024 11:22:51 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id y18-20020a056402359200b005648d0eebdbsm1141497edc.96.2024.03.09.11.22.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:22:50 -0800 (PST) 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: 6bb07afb-de4a-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012171; x=1710616971; 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=cFjMT6zDVz6FC8tPUCQ4kyyMrqKZ8chKsrslRHOyQyw=; b=hqWP6DRWgkzN45MOE2UT7rnZNTDaIdFeIGsBI7g0SFhcDByj9VNMn4tkv4RkII1SMW 3et43EGjnaA6tmM/e49eWaloOqs0OeRtSmK7+27UnNt+1+vmhsyVezXIBVBSUePwhDnn YljL/icdZ9C6eIM2fRZWl9vWbP7F8bva/HIM/qnIFizRllMbpTE+/0Ez8ge/pQkRxM6V LIvd69B9wZaPNnCBlQyFv0FELtqvtzvrbRN/B3jHjqM6tSM5ci9A4+7Y+jJpwHmt9sxv SesTlMfqleuwZDPUXf1qIHRV/39FHXMAlqDI6wvu0Vntz2+SJGh4/f+ERpI2A7r89NwB 9YRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012171; x=1710616971; 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=cFjMT6zDVz6FC8tPUCQ4kyyMrqKZ8chKsrslRHOyQyw=; b=ah1+w6EQNqYaIt4ubwFX5YbS0FOAXpCYkuCY1YuoeDv8DDYT0EnYeziSEHOCIez9lc 5eEANgEvD/gQgRqBktDfwfq5/RVih/KAeg6SNZNqQMcEb2RnZniSfZmySWAzYUyawcAq LwrPcXbXktZ9CIrT3PDdSHLahjTPO5IrD03OtjtAv25bSPdeLi5DnJoCsTr01tH0uiAM mPNFniOVVWWxh5RQnbmXzGa5TAtljJMej4icu+W6rsHW6v46900LNTEgwSbkgUJYieHd iDOSXJ2syHdJ/jFh1RNXk0RNqCtGxs8GOFbAGCpNBUqDmpyoKhXoy0PRfNQ+x/Obh4IW pPOw== X-Forwarded-Encrypted: i=1; AJvYcCVQCkqfxWCRSkkgpRcKFSYWX+cQS0YKgnFEVjCPXuhMkgw2/ngsIiY+GpX6d4DHuLa6kfeO9SWRCbXl+ge8Us8X0dmQ2sf3SuSFPBiFvmM= X-Gm-Message-State: AOJu0Yz/B2TMgwHavTWwAnetKgB7Z2QIN+xWC8QgYIo/HZMHK+1YPtJo 9QRxoIfdqTQ8KfwqT+PfU+ZUUHTO/z/+aCyJ5S6GmWZ3Qwlf4ZEDNtTyWr5TMc4= X-Google-Smtp-Source: AGHT+IEOGwIBYdP/mzwuHWgPMjU0SlF6nHZcYJJa0Wt9irOScU0CVSd5Ssk82Pi/m/B9Cv/46kpyew== X-Received: by 2002:a50:934a:0:b0:568:1882:651f with SMTP id n10-20020a50934a000000b005681882651fmr1774495eda.25.1710012170814; Sat, 09 Mar 2024 11:22:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , David Woodhouse , Stefano Stabellini , Anthony Perard , Paul Durrant , Paolo Bonzini , xen-devel@lists.xenproject.org Subject: [PULL 06/43] hw/xen: Remove unnecessary xen_hvm_inject_msi() stub Date: Sat, 9 Mar 2024 20:21:33 +0100 Message-ID: <20240309192213.23420-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 Since commit 04b0de0ee8 ("xen: factor out common functions") xen_hvm_inject_msi() stub is not required. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-8-philmd@linaro.org> --- stubs/xen-hw-stub.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stubs/xen-hw-stub.c b/stubs/xen-hw-stub.c index 7d7ffe83a9..6cf0e9a4c1 100644 --- a/stubs/xen-hw-stub.c +++ b/stubs/xen-hw-stub.c @@ -24,10 +24,6 @@ int xen_set_pci_link_route(uint8_t link, uint8_t irq) return -1; } -void xen_hvm_inject_msi(uint64_t addr, uint32_t data) -{ -} - int xen_is_pirq_msi(uint32_t msi_data) { return 0; From patchwork Sat Mar 9 19:21:34 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: 13587863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3342BC54E60 for ; Sat, 9 Mar 2024 19:23:09 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690971.1076685 (Exim 4.92) (envelope-from ) id 1rj2Hd-0001Ry-Jk; Sat, 09 Mar 2024 19:23:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690971.1076685; Sat, 09 Mar 2024 19:23:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2Hd-0001Rr-Gp; Sat, 09 Mar 2024 19:23:01 +0000 Received: by outflank-mailman (input) for mailman id 690971; Sat, 09 Mar 2024 19:22:59 +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 1rj2Hb-0001PG-TJ for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:22:59 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6f7053c8-de4a-11ee-afdb-a90da7624cb6; Sat, 09 Mar 2024 20:22:58 +0100 (CET) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51321e71673so3517333e87.2 for ; Sat, 09 Mar 2024 11:22:57 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id 24-20020a508e58000000b00566f92f1facsm1220206edx.36.2024.03.09.11.22.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:22:56 -0800 (PST) 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: 6f7053c8-de4a-11ee-afdb-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012177; x=1710616977; 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=5TjXBOuAt82J0vCEpvih+prFEkSXa24TTOPlq290ir4=; b=dzI5nZudVzm/07E0dJ9+u14kaSFAahpYErUiYSNzNJhul0vvQZDBs9hXURwhEZIWAn ZuugjowlFPVIoz1DoWViIKiq99K2e9hBs7i8hM7F2YzZUAqgfwqUQP/92SW0Alin5WJA iSLk0EYLvMTuXYmVjXsCdsSMAmxTCcxLSLKNoEsU5jYVdrNSCUJh3A91GY2P8UtPxlX6 6bAgRLxzE0sVEX+XRrFPda482zJI3JoYfHkp1dt29S9tZ0NNeEFvsZZVAKLB2jNc01LU 8rZGOnbOgy2PMp6TJ/xDB2eVXgSyRPhhZybwL1JeOCRnXGL8TVuhi4Z+jjX0LcZg/+sS wSvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012177; x=1710616977; 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=5TjXBOuAt82J0vCEpvih+prFEkSXa24TTOPlq290ir4=; b=XRMLEBxjYPXa0/+Whv56TeWKN1acN0fEWtZ0qj7lJTIYFvF7fF2siiGaW+3lI1xVGP gBKVN2AmnrRfc7dsrG4Ngujbo8Z87J1IaLHQCLIL2At0Udf34KQfe0MXO03fRn3D/fp1 lUbY/mgfFLVDU8W+9qjUmgoNl25gVCSQ1Ll92HkSZefxcZjwUnBXdYtLGtMNZ4Ca63P8 XXsvVu4/Dnc0uMsfULvZWaU3eMnUV39ktvNDlNu0SFJU1nb2562d+UxMeUVgr3IncOBR bSByvxzf65Qs5O5PiyGvANKkQYPvRYrM3CqvkADWTnYmjNVxx4D7fNejIq+4/Bja7l3u H0DQ== X-Forwarded-Encrypted: i=1; AJvYcCWunoYpHV5tDT7QbgJZDW7O5Ozc5o1hH0LKALvVRCHIvVVoxAqCX5HLAtq/fcNZ1LAtLMyj2/pjKas2f7fMa62LDaqpB/Z6PyZwuouI1yA= X-Gm-Message-State: AOJu0YzKjwsgbjBMiQpxa5dd0qVs/F/ArWbypje2EZyg5ZfOq95WCBpZ pRpK6BbI0byag2fgBk61Ve9C0xBoJ2sK11HhhjPRH9QXBMUmn3gxg96kmdP0LHw= X-Google-Smtp-Source: AGHT+IFu3iF5YfsPHFl4QgKzLThNg0KEglVlBZvKN0xPMmy0J9g6tryab3kSYkTuJAqwUaCGcPfaPg== X-Received: by 2002:a19:ae17:0:b0:512:d6b6:dc44 with SMTP id f23-20020a19ae17000000b00512d6b6dc44mr1371505lfc.66.1710012177076; Sat, 09 Mar 2024 11:22:57 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , David Woodhouse , Peter Maydell , Stefano Stabellini , Anthony Perard , Paul Durrant , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , xen-devel@lists.xenproject.org Subject: [PULL 07/43] hw/xen: Rename 'ram_memory' global variable as 'xen_memory' Date: Sat, 9 Mar 2024 20:21:34 +0100 Message-ID: <20240309192213.23420-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 To avoid a potential global variable shadow in hw/i386/pc_piix.c::pc_init1(), rename Xen's "ram_memory" as "xen_memory". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-11-philmd@linaro.org> --- include/hw/xen/xen-hvm-common.h | 2 +- hw/arm/xen_arm.c | 6 +++--- hw/i386/xen/xen-hvm.c | 10 +++++----- hw/xen/xen-hvm-common.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/hw/xen/xen-hvm-common.h b/include/hw/xen/xen-hvm-common.h index 4b1d728f35..65a51aac2e 100644 --- a/include/hw/xen/xen-hvm-common.h +++ b/include/hw/xen/xen-hvm-common.h @@ -15,7 +15,7 @@ #include "qemu/error-report.h" #include -extern MemoryRegion ram_memory; +extern MemoryRegion xen_memory; extern MemoryListener xen_io_listener; extern DeviceListener xen_device_listener; diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c index 32776d94df..15fa7dfa84 100644 --- a/hw/arm/xen_arm.c +++ b/hw/arm/xen_arm.c @@ -114,14 +114,14 @@ static void xen_init_ram(MachineState *machine) block_len = GUEST_RAM1_BASE + ram_size[1]; } - memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len, + memory_region_init_ram(&xen_memory, NULL, "xen.ram", block_len, &error_fatal); - memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo", &ram_memory, + memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo", &xen_memory, GUEST_RAM0_BASE, ram_size[0]); memory_region_add_subregion(sysmem, GUEST_RAM0_BASE, &ram_lo); if (ram_size[1] > 0) { - memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi", &ram_memory, + memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi", &xen_memory, GUEST_RAM1_BASE, ram_size[1]); memory_region_add_subregion(sysmem, GUEST_RAM1_BASE, &ram_hi); } diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index f42621e674..1ae943370b 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -149,12 +149,12 @@ static void xen_ram_init(PCMachineState *pcms, */ block_len = (4 * GiB) + x86ms->above_4g_mem_size; } - memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len, + memory_region_init_ram(&xen_memory, NULL, "xen.ram", block_len, &error_fatal); - *ram_memory_p = &ram_memory; + *ram_memory_p = &xen_memory; memory_region_init_alias(&ram_640k, NULL, "xen.ram.640k", - &ram_memory, 0, 0xa0000); + &xen_memory, 0, 0xa0000); memory_region_add_subregion(sysmem, 0, &ram_640k); /* Skip of the VGA IO memory space, it will be registered later by the VGA * emulated device. @@ -163,12 +163,12 @@ static void xen_ram_init(PCMachineState *pcms, * the Options ROM, so it is registered here as RAM. */ memory_region_init_alias(&ram_lo, NULL, "xen.ram.lo", - &ram_memory, 0xc0000, + &xen_memory, 0xc0000, x86ms->below_4g_mem_size - 0xc0000); memory_region_add_subregion(sysmem, 0xc0000, &ram_lo); if (x86ms->above_4g_mem_size > 0) { memory_region_init_alias(&ram_hi, NULL, "xen.ram.hi", - &ram_memory, 0x100000000ULL, + &xen_memory, 0x100000000ULL, x86ms->above_4g_mem_size); memory_region_add_subregion(sysmem, 0x100000000ULL, &ram_hi); } diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index baa1adb9f2..dc69cada57 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -9,7 +9,7 @@ #include "hw/boards.h" #include "hw/xen/arch_hvm.h" -MemoryRegion ram_memory; +MemoryRegion xen_memory; void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, Error **errp) @@ -26,7 +26,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, return; } - if (mr == &ram_memory) { + if (mr == &xen_memory) { return; } @@ -53,7 +53,7 @@ static void xen_set_memory(struct MemoryListener *listener, { XenIOState *state = container_of(listener, XenIOState, memory_listener); - if (section->mr == &ram_memory) { + if (section->mr == &xen_memory) { return; } else { if (add) { From patchwork Sat Mar 9 19:21:35 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: 13587864 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 851E0C54E60 for ; Sat, 9 Mar 2024 19:23:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690972.1076694 (Exim 4.92) (envelope-from ) id 1rj2Hh-0001m4-VY; Sat, 09 Mar 2024 19:23:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690972.1076694; Sat, 09 Mar 2024 19:23:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2Hh-0001lx-SP; Sat, 09 Mar 2024 19:23:05 +0000 Received: by outflank-mailman (input) for mailman id 690972; Sat, 09 Mar 2024 19:23:05 +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 1rj2Hh-0000Lp-6g for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:05 +0000 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [2a00:1450:4864:20::631]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7319aa81-de4a-11ee-a1ee-f123f15fe8a2; Sat, 09 Mar 2024 20:23:03 +0100 (CET) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a45aa7cb2b3so235244866b.3 for ; Sat, 09 Mar 2024 11:23:03 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id x19-20020a1709064bd300b00a44e2f3024bsm1172780ejv.68.2024.03.09.11.23.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:02 -0800 (PST) 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: 7319aa81-de4a-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012183; x=1710616983; 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=Q44dwAJ9zWJURYp9hh0U7wvOFqEH1mwy4JxGXOeg8jA=; b=N30iY6udcSXFerUkOTtu1tk37o+Ry8uP2nm5eR32c0NFM3bWwetYf6+0lCc/gcJRwv n4RU4uw5f4HcQAYtEh+uzrUMpUj+S4gQQMu/R5eCIU9bQycAGYMLQy/AYJpCq0drQCkT Ki/ZXHtD6AuBed6P2KXaaqKt+PEblN/CEXiZ2PQAxyzk+nVeGCPCz97KEt1lcHg0pVXK Sb7bAetNJ2MUZHGXsZvWoyKzE6+Abf/g6gBs+0zPQretHSj2iTd/wKMXVxSIKhHK3fct oWMRFgEhaftQYn0JrVXY1NQS0D+iPNu/+mwYar+LnzRtFeS9SIeMTsykHDgECBV690iO D9qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012183; x=1710616983; 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=Q44dwAJ9zWJURYp9hh0U7wvOFqEH1mwy4JxGXOeg8jA=; b=P/JbiVpwvMXPgWTHwmQ0pQxKK2pmFEXMNyROXY/HB5hYAUDyCt6qCOjjOyVqsFQBDm LDhiHXWW9bahuPPrTFDfrwMRXGo0CzReAe01ZkF7HzLby6RlofdxEMYjv2SUc79YOlzU 1yIWWD1UD0LHUztct50VgybGrOzhL2iNGinjgugv6bsOvdT6aoABnIZ2n2TKyaNALF37 VW3U+kw3FFtCiD4FrYswZDiLYHKfL5I06+ttlQk6jmSaEVNuT1DoPmwzxb2PNULwbgAn zK45ZB/WEc6pvNRAOggNGl1jS/caTjwYTE9DnxQem1QhNc4/e2ahUZZapaW07uLIcy8d MRcg== X-Forwarded-Encrypted: i=1; AJvYcCXEgKwK+4EBszgYaiutHoTdk7SmjPbL55lzzCtmpHWWVph4dy0Xz33DHPfdkabMskPWJl6meQEpw9Fy2hypF/8MjvVWO++OUguMN+10rCE= X-Gm-Message-State: AOJu0Yy5WylpHd3eHpvorQV5G9H0gT2iofV9T+vXOU3+u/GXq+S+N9Oh /Y4UZk5AtiW7sTtLymK7cLX1qIG1DA9PQ/eVg3rCSdNxuX6YlhEvs8GN1RcDwDQ= X-Google-Smtp-Source: AGHT+IHOQkfTUB7DFZUnzFt5SN8xXU0FWBVOfPyoMZQqgOTUu5nO+XttuLhInRopNUGb3cs1S/BhDQ== X-Received: by 2002:a17:907:7898:b0:a45:119e:3dec with SMTP id ku24-20020a170907789800b00a45119e3decmr1327777ejc.73.1710012183067; Sat, 09 Mar 2024 11:23:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Richard Henderson , David Woodhouse , Stefano Stabellini , Anthony Perard , Paul Durrant , xen-devel@lists.xenproject.org Subject: [PULL 08/43] hw/xen: Use target-agnostic qemu_target_page_bits() Date: Sat, 9 Mar 2024 20:21:35 +0100 Message-ID: <20240309192213.23420-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 Instead of the target-specific TARGET_PAGE_BITS definition, use qemu_target_page_bits() which is target agnostic. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-15-philmd@linaro.org> --- hw/xen/xen-hvm-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c index dc69cada57..1627da7398 100644 --- a/hw/xen/xen-hvm-common.c +++ b/hw/xen/xen-hvm-common.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qapi/error.h" +#include "exec/target_page.h" #include "trace.h" #include "hw/pci/pci_host.h" @@ -14,6 +15,7 @@ MemoryRegion xen_memory; void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, Error **errp) { + unsigned target_page_bits = qemu_target_page_bits(); unsigned long nr_pfn; xen_pfn_t *pfn_list; int i; @@ -32,11 +34,11 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, MemoryRegion *mr, trace_xen_ram_alloc(ram_addr, size); - nr_pfn = size >> TARGET_PAGE_BITS; + nr_pfn = size >> target_page_bits; pfn_list = g_new(xen_pfn_t, nr_pfn); for (i = 0; i < nr_pfn; i++) { - pfn_list[i] = (ram_addr >> TARGET_PAGE_BITS) + i; + pfn_list[i] = (ram_addr >> target_page_bits) + i; } if (xc_domain_populate_physmap_exact(xen_xc, xen_domid, nr_pfn, 0, 0, pfn_list)) { From patchwork Sat Mar 9 19:21:36 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: 13587865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69A63C54E60 for ; Sat, 9 Mar 2024 19:23:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690973.1076705 (Exim 4.92) (envelope-from ) id 1rj2Hn-0002BR-6Q; Sat, 09 Mar 2024 19:23:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690973.1076705; Sat, 09 Mar 2024 19:23:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2Hn-0002BK-3K; Sat, 09 Mar 2024 19:23:11 +0000 Received: by outflank-mailman (input) for mailman id 690973; Sat, 09 Mar 2024 19:23:09 +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 1rj2Hl-0001PG-Ih for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:09 +0000 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [2a00:1450:4864:20::230]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7663cc5e-de4a-11ee-afdb-a90da7624cb6; Sat, 09 Mar 2024 20:23:09 +0100 (CET) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2d29aad15a5so27055951fa.3 for ; Sat, 09 Mar 2024 11:23:09 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id fg3-20020a056402548300b005656bbb5b3fsm1153256edb.63.2024.03.09.11.23.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:08 -0800 (PST) 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: 7663cc5e-de4a-11ee-afdb-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012189; x=1710616989; 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=9jsjeEWjsUkRHeCpOh+pko9UBxzZs1OaWzN0fIY08/s=; b=kbFeCqtcxyu0ZMoPR+81vtw2gCiXdwtkkXHsZzeNQfQEPGLzFwf/LZo9US35DRqPi9 JbEoUIWP087d8hLPW7k44KNXjZyvT01OHjdrulF4fybUEOJMmc/CfmQ8yYvvisOazcgB w9jjQBbeY4rl7epZ9gGoY7eXW7IQya1GX6Mrs8S/8pgHWVh/X3mUmrIUXv6T/a+lMGsy rgdcZ2KrTBWS9i8T6ByiCAXFX2eO7tCWO6Nh5uY2+4RRW1GRXqG0YE13kjp0J5RqIApD kv9CqtNIahDBdaceKpZRbn+0LbJX1rs8QWlkduoLuGe3SXMWIGX39Q9YtKfo+AYIdXQ5 DMNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012189; x=1710616989; 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=9jsjeEWjsUkRHeCpOh+pko9UBxzZs1OaWzN0fIY08/s=; b=O2T7JIMRJ66WLMyNTih1ZIB7A19BwTmODmD4ecSbYejcxD7OHERIsVcHFEC460dTiP F5fn6S6oxUnHkskPrSyxcWcAesz9WHCXyS8wsyBm9r13wGPSzVJ0ighJ+YwccMMjnEJZ wFLX7beuAkLqeEC5bd46gauYs586pqqptYAvHbc9SlmcXjwNCjT4L52icN+bJaposCwA namym6zBrezQ1x0BY/tmmg9FxM472EuzhGwAWgHyH4aOQ6bAaPESr7D0dzKcc7CrS9Kk HHFtW9XO5K/+mgP5ed4gAGWageQQCGsE4v5VBRscszT0UnCuY4/j704EiEp7vh6pmnBO JHCQ== X-Forwarded-Encrypted: i=1; AJvYcCUj/90gRVbTQvoQ3JSErjilhFs79tm0+Rlo5i1itc55bJ+pFrBNwPiXA6wqWBpz8PRhHriifPPtGpnmsdbfPzQtJpTho5iQftFF50M9ywM= X-Gm-Message-State: AOJu0Yzs7cMbCFh5+rb+nbu8SBvYIEXRaU83usxcUX8eFt8MES8nQlxX Fc2YtMzEkeCIljbbY5kvjfmxlopeQodnYC5VifSZIDlMBwX8MfurKQciXhzJsWk= X-Google-Smtp-Source: AGHT+IHVJYQKMJoF6M5h+nBzkB9MQSOKRczhtHaq4vuFR2+EzQeH6DE9+nIiaOsLgRl8gEGAHG9UzQ== X-Received: by 2002:a05:651c:61f:b0:2d4:22b6:e6a4 with SMTP id k31-20020a05651c061f00b002d422b6e6a4mr1215415lje.30.1710012188800; Sat, 09 Mar 2024 11:23:08 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , David Woodhouse , Stefano Stabellini , Anthony Perard , Paul Durrant , xen-devel@lists.xenproject.org Subject: [PULL 09/43] hw/xen/xen_pt: Add missing license Date: Sat, 9 Mar 2024 20:21:36 +0100 Message-ID: <20240309192213.23420-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 Commit eaab4d60d3 ("Introduce Xen PCI Passthrough, qdevice") introduced both xen_pt.[ch], but only added the license to xen_pt.c. Use the same license for xen_pt.h. Suggested-by: David Woodhouse Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-17-philmd@linaro.org> --- hw/xen/xen_pt.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h index 31bcfdf705..d3180bb134 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2007, Neocleus Corporation. + * Copyright (c) 2007, Intel Corporation. + * + * SPDX-License-Identifier: GPL-2.0-only + * + * Alex Novik + * Allen Kay + * Guy Zana + */ #ifndef XEN_PT_H #define XEN_PT_H From patchwork Sat Mar 9 19:21:37 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: 13587866 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07917C54E60 for ; Sat, 9 Mar 2024 19:23:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690974.1076715 (Exim 4.92) (envelope-from ) id 1rj2Ht-0002de-Dz; Sat, 09 Mar 2024 19:23:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690974.1076715; Sat, 09 Mar 2024 19:23:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2Ht-0002dV-Ay; Sat, 09 Mar 2024 19:23:17 +0000 Received: by outflank-mailman (input) for mailman id 690974; Sat, 09 Mar 2024 19:23:16 +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 1rj2Hs-0001PG-9Y for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:16 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7a608a61-de4a-11ee-afdb-a90da7624cb6; Sat, 09 Mar 2024 20:23:15 +0100 (CET) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5131316693cso4162562e87.0 for ; Sat, 09 Mar 2024 11:23:15 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id p16-20020a17090653d000b00a45464679b1sm1162257ejo.127.2024.03.09.11.23.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:15 -0800 (PST) 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: 7a608a61-de4a-11ee-afdb-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012195; x=1710616995; 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=0dapH6sMmnV9ZamVJJtysMb9yL4xw8w3bAoh22EL4Vo=; b=fHCxpYTJrujOGvx39nMCUL0k5oKD5+rHFeT5I+lFFnN4j068UFbLSG/WOLeEM1/ZZH VQ+ShR+2TCfQHNsG5C8vMloNdd7NFyttFp1ENyqj1z0/jdFnGrL3h3Dgn+0NSbPBoccV PQv6+jix2ZrszySLNw6mU7Rbq5QKs201e0NS79WHEwviKTOJaP7vtjQjnph8/wnli1/B WuaGqE72Blhnul0+66zjBxSNh98Dro0+qPVvZAgDTkcyOqDOLHVA++yzDe+vS+2Dw+gp eF5u8qTBQNFvjGUNXRdXCENCR3in48YGY2ykg6YsYgLQit8ZKshUk0cCyuX9WegJZ4qO o2Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012195; x=1710616995; 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=0dapH6sMmnV9ZamVJJtysMb9yL4xw8w3bAoh22EL4Vo=; b=Ppo5TI/Yyvp2rjXG1SynzSn1AYJViCYlku2aGhAB6UX1pLYrBgzVybofkcRqf4/5uN WpOt8EHH+CEzl6rmdjkaoDFTNRIWVhy9PnDD3q01W/CScowecRN2vQF3uZHnU/4PZnva xIOrsBrcxNo0M4L7q/od0kO0lnm+mdxkMsOGcJWFqB4un2K+dg0OfNAvwIJLuNEA5khX nsSurh7ed8juKI/DgoTjlY5nKelLD8f7ZKalz3rDyT2iy2RhwmFIlPEWS5jz1basghkU rH4L62tyDK6l5o5wL7bbAVGDCbusrjF944qHJ3Z80wb1VJXKsMnIvvx/SWzSHSpRLrFw +Lmg== X-Forwarded-Encrypted: i=1; AJvYcCWcUz2V1bll2BET1Rj/LjW8uJ27NopxQpovkVD7E/p2kEoYDS5UvBoZqclmNwvjDx47Yb2E/QX47aNhlaQqFItoTDLSs9a4E+je83/cAe4= X-Gm-Message-State: AOJu0Yym+YItdot1fU8kRrHveAnrtxOaDYbRUgcFwMCqzc0Q1MyBUl6V vDqAu78YEB485kwzUy89+LHq1SzIiLFuKjbAXrwIC/2MCjGexb0w3JUMbxWPlu0= X-Google-Smtp-Source: AGHT+IFZ9Fs+PsF2jnfTNVld6iD1aF/yC/++Clb+ISz5eMReGA6KlLI+TlLWLbqJFmWdTAeuAL2cvw== X-Received: by 2002:a19:f709:0:b0:513:54c6:9f68 with SMTP id z9-20020a19f709000000b0051354c69f68mr1301272lfe.18.1710012195436; Sat, 09 Mar 2024 11:23:15 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , David Woodhouse , Stefano Stabellini , Anthony Perard , Paul Durrant , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , xen-devel@lists.xenproject.org Subject: [PULL 10/43] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h' Date: Sat, 9 Mar 2024 20:21:37 +0100 Message-ID: <20240309192213.23420-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 "hw/xen/xen_pt.h" requires "hw/xen/xen_native.h" which is target specific. It also declares IGD methods, which are not target specific. Target-agnostic code can use IGD methods. To allow that, extract these methos into a new "hw/xen/xen_igd.h" header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-18-philmd@linaro.org> --- hw/xen/xen_pt.h | 14 -------------- include/hw/xen/xen_igd.h | 33 +++++++++++++++++++++++++++++++++ accel/xen/xen-all.c | 1 + hw/i386/pc_piix.c | 1 + hw/xen/xen_pt.c | 3 ++- hw/xen/xen_pt_config_init.c | 3 ++- hw/xen/xen_pt_graphics.c | 3 ++- hw/xen/xen_pt_stub.c | 2 +- 8 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 include/hw/xen/xen_igd.h diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h index d3180bb134..095a0f0365 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -15,9 +15,6 @@ #include "xen-host-pci-device.h" #include "qom/object.h" -bool xen_igd_gfx_pt_enabled(void); -void xen_igd_gfx_pt_set(bool value, Error **errp); - void xen_pt_log(const PCIDevice *d, const char *f, ...) G_GNUC_PRINTF(2, 3); #define XEN_PT_ERR(d, _f, _a...) xen_pt_log(d, "%s: Error: "_f, __func__, ##_a) @@ -62,12 +59,6 @@ typedef struct XenPTDeviceClass { XenPTQdevRealize pci_qdev_realize; } XenPTDeviceClass; -uint32_t igd_read_opregion(XenPCIPassthroughState *s); -void xen_igd_reserve_slot(PCIBus *pci_bus); -void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val); -void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s, - XenHostPCIDevice *dev); - /* function type for config reg */ typedef int (*xen_pt_conf_reg_init) (XenPCIPassthroughState *, XenPTRegInfo *, uint32_t real_offset, @@ -353,11 +344,6 @@ static inline bool xen_pt_has_msix_mapping(XenPCIPassthroughState *s, int bar) void *pci_assign_dev_load_option_rom(PCIDevice *dev, int *size, unsigned int domain, unsigned int bus, unsigned int slot, unsigned int function); -static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev) -{ - return (xen_igd_gfx_pt_enabled() - && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA)); -} int xen_pt_register_vga_regions(XenHostPCIDevice *dev); int xen_pt_unregister_vga_regions(XenHostPCIDevice *dev); void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHostPCIDevice *dev, diff --git a/include/hw/xen/xen_igd.h b/include/hw/xen/xen_igd.h new file mode 100644 index 0000000000..7ffca06c10 --- /dev/null +++ b/include/hw/xen/xen_igd.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2007, Neocleus Corporation. + * Copyright (c) 2007, Intel Corporation. + * + * SPDX-License-Identifier: GPL-2.0-only + * + * Alex Novik + * Allen Kay + * Guy Zana + */ +#ifndef XEN_IGD_H +#define XEN_IGD_H + +#include "hw/xen/xen-host-pci-device.h" + +typedef struct XenPCIPassthroughState XenPCIPassthroughState; + +bool xen_igd_gfx_pt_enabled(void); +void xen_igd_gfx_pt_set(bool value, Error **errp); + +uint32_t igd_read_opregion(XenPCIPassthroughState *s); +void xen_igd_reserve_slot(PCIBus *pci_bus); +void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val); +void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s, + XenHostPCIDevice *dev); + +static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev) +{ + return (xen_igd_gfx_pt_enabled() + && ((dev->class_code >> 0x8) == PCI_CLASS_DISPLAY_VGA)); +} + +#endif diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 5ff0cb8bd9..0bdefce537 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -15,6 +15,7 @@ #include "hw/xen/xen_native.h" #include "hw/xen/xen-legacy-backend.h" #include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "chardev/char.h" #include "qemu/accel.h" #include "sysemu/cpus.h" diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ce6aad758d..e123458bbc 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -55,6 +55,7 @@ #ifdef CONFIG_XEN #include #include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #endif #include "hw/xen/xen-x86.h" #include "hw/xen/xen.h" diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 36e6f93c37..a8edabdabc 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -59,7 +59,8 @@ #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" -#include "xen_pt.h" +#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "hw/xen/xen.h" #include "hw/xen/xen-legacy-backend.h" #include "qemu/range.h" diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index 2b8680b112..ba4cd78238 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -15,7 +15,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/timer.h" -#include "xen_pt.h" +#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "hw/xen/xen-legacy-backend.h" #define XEN_PT_MERGE_VALUE(value, data, val_mask) \ diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index 0aed3bb6fd..6c2e3f4840 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -3,7 +3,8 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include "xen_pt.h" +#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "xen-host-pci-device.h" static unsigned long igd_guest_opregion; diff --git a/hw/xen/xen_pt_stub.c b/hw/xen/xen_pt_stub.c index 5c108446a8..72feebeb20 100644 --- a/hw/xen/xen_pt_stub.c +++ b/hw/xen/xen_pt_stub.c @@ -6,7 +6,7 @@ */ #include "qemu/osdep.h" -#include "hw/xen/xen_pt.h" +#include "hw/xen/xen_igd.h" #include "qapi/error.h" bool xen_igd_gfx_pt_enabled(void) From patchwork Sat Mar 9 19:21:38 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: 13587867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 04F7DC54E60 for ; Sat, 9 Mar 2024 19:23:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690976.1076726 (Exim 4.92) (envelope-from ) id 1rj2I1-0003Hc-Nq; Sat, 09 Mar 2024 19:23:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690976.1076726; Sat, 09 Mar 2024 19:23:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2I1-0003HU-IH; Sat, 09 Mar 2024 19:23:25 +0000 Received: by outflank-mailman (input) for mailman id 690976; Sat, 09 Mar 2024 19:23: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 1rj2Hz-0000Lp-MQ for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:23 +0000 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [2a00:1450:4864:20::631]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7e33ef02-de4a-11ee-a1ee-f123f15fe8a2; Sat, 09 Mar 2024 20:23:22 +0100 (CET) Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a44f2d894b7so410823566b.1 for ; Sat, 09 Mar 2024 11:23:22 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id g21-20020a170906595500b00a45a96a9c37sm1182786ejr.65.2024.03.09.11.23.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:21 -0800 (PST) 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: 7e33ef02-de4a-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012202; x=1710617002; 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=A3YPWAKLFpXy74v59/y9ZVQ7mfzqWdCePg5o0rXQJdU=; b=WGMZShYZLxi8XKRo8QOv1JT27KOo+vUH+RE2vuiFfnbXpIVXsWjrapKQlmhOT8hfdy PORz8Zyin31DkaKVjXtMB9rMLAy+RvQsSMHzIXCPcqBZ7OmoHSaLSXknqVkE3xqBtNQK Ka2m1anq4cXog7dj5m3o2eS+yViJY7WJ0vLhr7itViZ8fG+Gva/C2CcN/7C4VLvOrkr3 016+SeJnXKE4+CKg/WuVZwZ8NDpHAgU7xh0v7neLdstg1l4tM+dEcmPdJx1qIUcUUA9i vTiw1QqGM5V2eUN0Y1lS3cWeYU0St4bl+vSezz8PVBRj9ZBZeYJThjvfyB00CCb/gQMr PpDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012202; x=1710617002; 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=A3YPWAKLFpXy74v59/y9ZVQ7mfzqWdCePg5o0rXQJdU=; b=pjU2BYunbzat3gCVnJwqrjnC3f7lmiQn/CeSL49kQRmXhHjHtdVa36QrP6BwPlE/mr Ya4eKdNViYPvxJdmcx+0QiX4yauCdyYZqOXll3HPI2kfsmyZfN/8NF3b86VXmjhj+Cy9 IrLBb+TzNjTElwd5svBrhFkLQkBO+QZSKApq95/SR/jdPnlPN9aGRt826yUCv3zRxDCa rP0Ip0+m14BKkZ3HJVzRXIOrdeHntFY42ryHtFKH8E6Bm/ESpFRaLNXtPVdXxmBY+Ou5 2JBQV6tc0OAw8GGir1Lv1bqb295XlqNzeq1HUmSuupuCj7bqzorVKvy6hneGyrQ9sJFR O3sA== X-Forwarded-Encrypted: i=1; AJvYcCV7zGDt3AsloAqtQa/XqxlUApXQtzC0QBKK8OauU1/cYRIKUg2mDVS5Qlai1JZcnJeaOPGRrWFChMRiU2JFVa57GUTsKGSfZBuTlzMJUVk= X-Gm-Message-State: AOJu0YwXHJxy+59ntkzMi2j4dV1VuyM4Q31G8dD7oPo7jcChQNK5BZP9 qYZ7Bh4B/3yEZkYUasBBhnWll7+HIT9Bze6yGK8LtNh9iRQZskhkIAPfkhZQb9g= X-Google-Smtp-Source: AGHT+IESzjyaLuyggJlbtw/UU7wtPA1UXBAfVV9w8oQeEuaTMGyVqGqT6YAp9h+VrsWLnSESfaBeNA== X-Received: by 2002:a17:906:b110:b0:a45:c9fb:86d7 with SMTP id u16-20020a170906b11000b00a45c9fb86d7mr1387127ejy.54.1710012201803; Sat, 09 Mar 2024 11:23:21 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , David Woodhouse , Stefano Stabellini , Anthony Perard , Paul Durrant , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , xen-devel@lists.xenproject.org Subject: [PULL 11/43] hw/i386/xen: Compile 'xen-hvm.c' with Xen CPPFLAGS Date: Sat, 9 Mar 2024 20:21:38 +0100 Message-ID: <20240309192213.23420-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 xen-hvm.c calls xc_set_hvm_param() from , so better compile it with Xen CPPFLAGS. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: David Woodhouse Message-Id: <20231114143816.71079-19-philmd@linaro.org> --- hw/i386/xen/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/xen/meson.build b/hw/i386/xen/meson.build index 3dc4c4f106..3f0df8bc07 100644 --- a/hw/i386/xen/meson.build +++ b/hw/i386/xen/meson.build @@ -1,8 +1,10 @@ i386_ss.add(when: 'CONFIG_XEN', if_true: files( - 'xen-hvm.c', 'xen_apic.c', 'xen_pvdevice.c', )) +i386_ss.add(when: ['CONFIG_XEN', xen], if_true: files( + 'xen-hvm.c', +)) i386_ss.add(when: 'CONFIG_XEN_BUS', if_true: files( 'xen_platform.c', From patchwork Sat Mar 9 19:21:39 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: 13587868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7DAD3C54E60 for ; Sat, 9 Mar 2024 19:23:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690977.1076735 (Exim 4.92) (envelope-from ) id 1rj2I5-0003jX-U3; Sat, 09 Mar 2024 19:23:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690977.1076735; Sat, 09 Mar 2024 19:23: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 1rj2I5-0003ik-R8; Sat, 09 Mar 2024 19:23:29 +0000 Received: by outflank-mailman (input) for mailman id 690977; Sat, 09 Mar 2024 19:23: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 1rj2I4-0001PG-PI for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:28 +0000 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [2a00:1450:4864:20::534]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 81d4d069-de4a-11ee-afdb-a90da7624cb6; Sat, 09 Mar 2024 20:23:28 +0100 (CET) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-568107a9ff2so3517022a12.3 for ; Sat, 09 Mar 2024 11:23:28 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id d18-20020a50fb12000000b0056486eaa669sm1182154edq.50.2024.03.09.11.23.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:27 -0800 (PST) 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: 81d4d069-de4a-11ee-afdb-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012208; x=1710617008; 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=yLHD9GT6b5p3TJG9MYP2E7Mrw1kvuaLUPhHVHq70H4k=; b=In1Lyq191c8Z+vXQDtP8fdftoqvjPNGRcCJIjkBSmIh1karawBCO1YaYH3cO0bE2B2 feHKgRTJbt+d4bVBgUuav2ejns+R6kxEQKr8M3nSDK+M9Msi+WOsuaD8DUSVsxfJk1rT 8Crv/o0qWQ+3mqSPESCA47rAgypJD/kBjYtXoo41WLgpFl5oGb2BfA52ITJtX3ZqQ2Vp DU3AE3em/wcWjeWMiJTYaPxPphngQx7GrIyIEh2jAYtnna0Ntu+hr3pnien1oxbt7+JR fxvvXZx2he4b6i39A7e7d6AXHpEfCMI+IFxqoDLKZGbIau11GlMJG4DS4t3pqD5B1q6M aSHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012208; x=1710617008; 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=yLHD9GT6b5p3TJG9MYP2E7Mrw1kvuaLUPhHVHq70H4k=; b=dPZ/RQTORjiLbWVLGSHdMKcWDmW1fsyCfz/5ipyytK8NCq2/+bbE0ZTpyPOyJHI9ix giSVHL0sAZMsXC1680GtlEKLS1fZL9i1WgQxKzmYT5EIBNheaJV/wxkGcAWumZIgSldg wVfwPDeCM41iQyNy5Jt0ziRo65T2X0TKPugPcKo/RjtPj41mPhMEV93AUJPXmtwZCnj1 /1un8FkbEZZvqAU41lEr2uJfdzXHowZHjxl7w/zAiCd9/PIb52eYe4E6PV0IYJodIHzV j7soScsEFk7HRabqHoNPMEUGmgV0fpMOnykOrBlB1m+rp+1gWdlloHaperxDQBNGhbxz L02g== X-Forwarded-Encrypted: i=1; AJvYcCWnJuU7vp6dmb1VXGpKyQBYKvdww2Fdq3pGSYpm0XjfZ+grgy/PSMHDn8lXpRz1dnUWNC9oLvQNxQZdJJtWVrDS3+BG8ThgssDFuOHBGR4= X-Gm-Message-State: AOJu0YyGZdbqyd22DAcUBi3mosD5tkjOfMiKS9AfdOE3+w8GRY8tQILe CbyYNF5J6SPwZ9vn/iWPRU/vP91XCbdl1OZ6A/7GllpTNrIS6eM//4tjeDZFgn8= X-Google-Smtp-Source: AGHT+IElag8KDyPQHd/yd7cCq1cSr3wdf4BCFyMPlhbecbflegKHRhCxKpfa2+2S5Xx9q4YSEt6pXw== X-Received: by 2002:a50:9fc9:0:b0:568:1b94:fb88 with SMTP id c67-20020a509fc9000000b005681b94fb88mr1660926edf.23.1710012208009; Sat, 09 Mar 2024 11:23:28 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Manos Pitsidianakis , Stefano Stabellini , Anthony Perard , Paul Durrant , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , xen-devel@lists.xenproject.org Subject: [PULL 12/43] hw/xen/hvm: Inline TARGET_PAGE_ALIGN() macro Date: Sat, 9 Mar 2024 20:21:39 +0100 Message-ID: <20240309192213.23420-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 Use TARGET_PAGE_SIZE to calculate TARGET_PAGE_ALIGN. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Message-Id: <20231114163123.74888-2-philmd@linaro.org> --- hw/i386/xen/xen-hvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 1ae943370b..8235782ef7 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -678,7 +678,7 @@ void arch_xen_set_memory(XenIOState *state, MemoryRegionSection *section, trace_xen_client_set_memory(start_addr, size, log_dirty); start_addr &= TARGET_PAGE_MASK; - size = TARGET_PAGE_ALIGN(size); + size = ROUND_UP(size, TARGET_PAGE_SIZE); if (add) { if (!memory_region_is_rom(section->mr)) { From patchwork Sat Mar 9 19:21:40 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: 13587869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2AD3C54E60 for ; Sat, 9 Mar 2024 19:23:43 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690979.1076746 (Exim 4.92) (envelope-from ) id 1rj2ID-0004IH-DC; Sat, 09 Mar 2024 19:23:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690979.1076746; Sat, 09 Mar 2024 19:23:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2ID-0004IA-8y; Sat, 09 Mar 2024 19:23:37 +0000 Received: by outflank-mailman (input) for mailman id 690979; Sat, 09 Mar 2024 19:23:36 +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 1rj2IC-0000Lp-3l for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:36 +0000 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [2a00:1450:4864:20::535]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 857f947f-de4a-11ee-a1ee-f123f15fe8a2; Sat, 09 Mar 2024 20:23:34 +0100 (CET) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5682360e095so2919755a12.1 for ; Sat, 09 Mar 2024 11:23:34 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id l20-20020a170906a41400b00a46163be639sm251749ejz.12.2024.03.09.11.23.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:33 -0800 (PST) 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: 857f947f-de4a-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012214; x=1710617014; 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=GjJ9Xc35+gwGwrFshf70kAsb/Zk8w4JUpjKATwEq64Y=; b=Cz93Ty6kH9Ww33ARglTIEs5esvgrOwNs6eu98xl9xRIsRJ6jCcEfkJE6TZGABnY0Os E4PDiRG9cwpEVowt3vdpdLBrQrx5iUnfoV5+QCBfkzvFA9IBs7C6CJgbFHPvVUfpqEmT TFVFArMbQHJCNcACjdkCUzoIwPO23jw9nMvh7QzlzuS5mD7zHwVipOkblYGa610SKEdx qVAQE7g0UyeiRz/Blb43JeXi7jV3hqZOKoUhkbcrd0+KXdf/5MlV4G7Kju/GZYFLRI56 To0miIHACBrtgSWKHKCLXEpOFk+8QoxGUOJdGezwx/NftnIEwfcvtCTXgWi9K+KMN5Ij QLgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012214; x=1710617014; 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=GjJ9Xc35+gwGwrFshf70kAsb/Zk8w4JUpjKATwEq64Y=; b=BLZRRsJ0pyyd5DPpoB9D5GvTVI+H35tMVqqz5P+V80GB3Dz9hrl8nLkP68gjk8KUeG E2L4e7jA752FK7DrbSxQKkkgeo0m4JzyIfPzcU6BDQxdY/rFDislBky92Y4STcuH1ABW ZNYiOrEX3owJYz4pKXS6Ix3JshsPreBZ8iRR+ctdKERJozhLUrVQW16ty/YnXroXhRF5 A4OD+/GrtoNTV84fRNPPfV/vPvuf0AFdRxnYRMRN4v5QcOMq+f2gz8lCTyMAojXpAm4V c1Vx5bFVBzYYmItPD264+8loksaq6JWEIjSoUcpy/G69CBIZ+WLK6/WKdsIySH16zobN Irlw== X-Forwarded-Encrypted: i=1; AJvYcCVwibozan0IzIMmNjCgIIXyu4zZFQy/x6l5wfD7jJYnRoaymQeaEsT4q3ga/2AFTxtPB6pq3b64clVhQZp4aXATr6PvzeZCEwYs7DgS0LY= X-Gm-Message-State: AOJu0YwoL3oWPNf437Tbg7aiN9frHnmSL3D+ZPUIS0Ty+YYgY7ig+w64 iYxRV78Ju4Xi7wO6BgVMWt40lkp6IHw2HTYN4ezVEBAu3NsbaHSyE6CZHE61Ap8= X-Google-Smtp-Source: AGHT+IFUzNU4pC8ZaO+fIzpjlcMgyQZHUIXDLCwBTxfANDlJj9gCS9ZbhsgrrNnhXeKdaH05pNglXQ== X-Received: by 2002:a17:907:d389:b0:a45:92c4:7892 with SMTP id vh9-20020a170907d38900b00a4592c47892mr1630790ejc.56.1710012214113; Sat, 09 Mar 2024 11:23:34 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Manos Pitsidianakis , Stefano Stabellini , Anthony Perard , Paul Durrant , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , xen-devel@lists.xenproject.org Subject: [PULL 13/43] hw/xen/hvm: Propagate page_mask to a pair of functions Date: Sat, 9 Mar 2024 20:21:40 +0100 Message-ID: <20240309192213.23420-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 We are going to replace TARGET_PAGE_MASK by a runtime variable. In order to reduce code duplication, propagate TARGET_PAGE_MASK to get_physmapping() and xen_phys_offset_to_gaddr(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Message-Id: <20231114163123.74888-3-philmd@linaro.org> --- hw/i386/xen/xen-hvm.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 8235782ef7..844b11ae08 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -174,11 +174,12 @@ static void xen_ram_init(PCMachineState *pcms, } } -static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size) +static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size, + int page_mask) { XenPhysmap *physmap = NULL; - start_addr &= TARGET_PAGE_MASK; + start_addr &= page_mask; QLIST_FOREACH(physmap, &xen_physmap, list) { if (range_covers_byte(physmap->start_addr, physmap->size, start_addr)) { @@ -188,9 +189,10 @@ static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size) return NULL; } -static hwaddr xen_phys_offset_to_gaddr(hwaddr phys_offset, ram_addr_t size) +static hwaddr xen_phys_offset_to_gaddr(hwaddr phys_offset, ram_addr_t size, + int page_mask) { - hwaddr addr = phys_offset & TARGET_PAGE_MASK; + hwaddr addr = phys_offset & page_mask; XenPhysmap *physmap = NULL; QLIST_FOREACH(physmap, &xen_physmap, list) { @@ -252,7 +254,7 @@ static int xen_add_to_physmap(XenIOState *state, hwaddr phys_offset = memory_region_get_ram_addr(mr); const char *mr_name; - if (get_physmapping(start_addr, size)) { + if (get_physmapping(start_addr, size, TARGET_PAGE_MASK)) { return 0; } if (size <= 0) { @@ -325,7 +327,7 @@ static int xen_remove_from_physmap(XenIOState *state, XenPhysmap *physmap = NULL; hwaddr phys_offset = 0; - physmap = get_physmapping(start_addr, size); + physmap = get_physmapping(start_addr, size, TARGET_PAGE_MASK); if (physmap == NULL) { return -1; } @@ -373,7 +375,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state, int rc, i, j; const XenPhysmap *physmap = NULL; - physmap = get_physmapping(start_addr, size); + physmap = get_physmapping(start_addr, size, TARGET_PAGE_MASK); if (physmap == NULL) { /* not handled */ return; @@ -633,7 +635,7 @@ void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) int rc; ram_addr_t start_pfn, nb_pages; - start = xen_phys_offset_to_gaddr(start, length); + start = xen_phys_offset_to_gaddr(start, length, TARGET_PAGE_MASK); if (length == 0) { length = TARGET_PAGE_SIZE; From patchwork Sat Mar 9 19:21:41 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: 13587870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCF6DC54791 for ; Sat, 9 Mar 2024 19:23:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690980.1076755 (Exim 4.92) (envelope-from ) id 1rj2II-0004mG-KM; Sat, 09 Mar 2024 19:23:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690980.1076755; Sat, 09 Mar 2024 19:23:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2II-0004m9-HM; Sat, 09 Mar 2024 19:23:42 +0000 Received: by outflank-mailman (input) for mailman id 690980; Sat, 09 Mar 2024 19:23:41 +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 1rj2IH-0001PG-JI for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:41 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8959b764-de4a-11ee-afdb-a90da7624cb6; Sat, 09 Mar 2024 20:23:41 +0100 (CET) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a44ad785a44so229182966b.3 for ; Sat, 09 Mar 2024 11:23:41 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id k9-20020a1709063e0900b00a45a73e0be9sm1167156eji.180.2024.03.09.11.23.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:40 -0800 (PST) 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: 8959b764-de4a-11ee-afdb-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012220; x=1710617020; 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=nJ7HW/Ft7i83AZTN2mskut6mEUi0nRJo8gD5MOoOvrw=; b=P8jkQ+ybtwbClY1iPTzida1BCEbdz/lFV879UtmldppvbbqOk2jOLyFBxx7ABRiujg UzzIrGRc8WUYaII3MCNeAiFFnfxC55I+QMBvfnvDBVp54RIAFnPpZgM9IrpPpsmalgHG SIQWrJcdrhzfUrqNi9CWl9Tuc+CfrDp3G3GYBF2p5DeYzHPFRqdG9pOx8DgtbZa3HkkA jHU15kA41b7A9XcZMd8ZdoPo04tydENv4Df970bRDMjwA+gKTCb7T4QF5tE5RbG8+7QC gLV2ArsJbpcBDmTo73TuBuSM8sD8CyPU9dk1EL/gsFqT24W+WcW1l54KPVXbR0TBRa8Z n7Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012220; x=1710617020; 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=nJ7HW/Ft7i83AZTN2mskut6mEUi0nRJo8gD5MOoOvrw=; b=WQaoEMfo1AfmP3DT3JfWydH2BTV0BsELObJStYFgKHEaVlZUQmu/i0P8ka35ErR7a4 BQgGmeAov9FKtU40QZe/mdZ4jVTYNx7pNXNE37rU/6kH2VfrvWR5AuLQdcfQf7KffT4t vWpRxwwEFlRz9ZIIBtmj3NhGhvA+OxY02HcTIWSI8h9hPcTskrNf7csKC8qY6+CGaKbI SgGP8x5BTymJxVJkaSWa0tRkR5eop7ybv5X6FcJZgFhVlYWU2NwaSvVVBr+oURQUx7Se oz5FDRZUNKvPRt2+47r6FNmwMXXct2ZZE2js/EHFGLtSMJCJwqAOViy4k/VxIcsCvHhd jKjw== X-Forwarded-Encrypted: i=1; AJvYcCXfxmG0dP3atvuY/zL80ZxPtpiO23lC23dRoFADIwFx1pCaRAvXW9ONiEMHVj1QGljj7u9knyIWtyYjLC3PUEAzgFzZp7hqnMj73aY+s2M= X-Gm-Message-State: AOJu0YwGpEP7Azw8/YpbpJOrO3AIxEwMAACV4+PGDQWrAs4eJbupcpoj 2W/XQc7a8gSuq7jqsqBvIOiuo6XG0EwxpX1bNgltSX7cD0it8CIFaZ/Wf3LrawU= X-Google-Smtp-Source: AGHT+IGJ8dRKKvAEJydBIDk5EIHimW4WL5gyfDXoimVbXutg1h6Ab0DpFGsPNz89nrlp7nNRGTQq2A== X-Received: by 2002:a17:907:96ab:b0:a44:17da:424 with SMTP id hd43-20020a17090796ab00b00a4417da0424mr1554598ejc.56.1710012220525; Sat, 09 Mar 2024 11:23:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Manos Pitsidianakis , Stefano Stabellini , Anthony Perard , Paul Durrant , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , xen-devel@lists.xenproject.org Subject: [PULL 14/43] hw/xen/hvm: Get target page size at runtime Date: Sat, 9 Mar 2024 20:21:41 +0100 Message-ID: <20240309192213.23420-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 In order to build this file once for all targets, replace: TARGET_PAGE_BITS -> qemu_target_page_bits() TARGET_PAGE_SIZE -> qemu_target_page_size() TARGET_PAGE_MASK -> -qemu_target_page_size() Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Message-Id: <20231114163123.74888-4-philmd@linaro.org> --- hw/i386/xen/xen-hvm.c | 62 +++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 844b11ae08..7745cb3963 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -23,6 +23,7 @@ #include "hw/xen/xen-hvm-common.h" #include "hw/xen/arch_hvm.h" #include +#include "exec/target_page.h" static MemoryRegion ram_640k, ram_lo, ram_hi; static MemoryRegion *framebuffer; @@ -247,6 +248,9 @@ static int xen_add_to_physmap(XenIOState *state, MemoryRegion *mr, hwaddr offset_within_region) { + unsigned target_page_bits = qemu_target_page_bits(); + int page_size = qemu_target_page_size(); + int page_mask = -page_size; unsigned long nr_pages; int rc = 0; XenPhysmap *physmap = NULL; @@ -254,7 +258,7 @@ static int xen_add_to_physmap(XenIOState *state, hwaddr phys_offset = memory_region_get_ram_addr(mr); const char *mr_name; - if (get_physmapping(start_addr, size, TARGET_PAGE_MASK)) { + if (get_physmapping(start_addr, size, page_mask)) { return 0; } if (size <= 0) { @@ -294,9 +298,9 @@ go_physmap: return 0; } - pfn = phys_offset >> TARGET_PAGE_BITS; - start_gpfn = start_addr >> TARGET_PAGE_BITS; - nr_pages = size >> TARGET_PAGE_BITS; + pfn = phys_offset >> target_page_bits; + start_gpfn = start_addr >> target_page_bits; + nr_pages = size >> target_page_bits; rc = xendevicemodel_relocate_memory(xen_dmod, xen_domid, nr_pages, pfn, start_gpfn); if (rc) { @@ -310,8 +314,8 @@ go_physmap: } rc = xendevicemodel_pin_memory_cacheattr(xen_dmod, xen_domid, - start_addr >> TARGET_PAGE_BITS, - (start_addr + size - 1) >> TARGET_PAGE_BITS, + start_addr >> target_page_bits, + (start_addr + size - 1) >> target_page_bits, XEN_DOMCTL_MEM_CACHEATTR_WB); if (rc) { error_report("pin_memory_cacheattr failed: %s", strerror(errno)); @@ -323,11 +327,14 @@ static int xen_remove_from_physmap(XenIOState *state, hwaddr start_addr, ram_addr_t size) { + unsigned target_page_bits = qemu_target_page_bits(); + int page_size = qemu_target_page_size(); + int page_mask = -page_size; int rc = 0; XenPhysmap *physmap = NULL; hwaddr phys_offset = 0; - physmap = get_physmapping(start_addr, size, TARGET_PAGE_MASK); + physmap = get_physmapping(start_addr, size, page_mask); if (physmap == NULL) { return -1; } @@ -338,9 +345,9 @@ static int xen_remove_from_physmap(XenIOState *state, DPRINTF("unmapping vram to %"HWADDR_PRIx" - %"HWADDR_PRIx", at " "%"HWADDR_PRIx"\n", start_addr, start_addr + size, phys_offset); - size >>= TARGET_PAGE_BITS; - start_addr >>= TARGET_PAGE_BITS; - phys_offset >>= TARGET_PAGE_BITS; + size >>= target_page_bits; + start_addr >>= target_page_bits; + phys_offset >>= target_page_bits; rc = xendevicemodel_relocate_memory(xen_dmod, xen_domid, size, start_addr, phys_offset); if (rc) { @@ -369,13 +376,16 @@ static void xen_sync_dirty_bitmap(XenIOState *state, hwaddr start_addr, ram_addr_t size) { - hwaddr npages = size >> TARGET_PAGE_BITS; + unsigned target_page_bits = qemu_target_page_bits(); + int page_size = qemu_target_page_size(); + int page_mask = -page_size; + hwaddr npages = size >> target_page_bits; const int width = sizeof(unsigned long) * 8; size_t bitmap_size = DIV_ROUND_UP(npages, width); int rc, i, j; const XenPhysmap *physmap = NULL; - physmap = get_physmapping(start_addr, size, TARGET_PAGE_MASK); + physmap = get_physmapping(start_addr, size, page_mask); if (physmap == NULL) { /* not handled */ return; @@ -389,7 +399,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state, return; } - rc = xen_track_dirty_vram(xen_domid, start_addr >> TARGET_PAGE_BITS, + rc = xen_track_dirty_vram(xen_domid, start_addr >> target_page_bits, npages, dirty_bitmap); if (rc < 0) { #ifndef ENODATA @@ -410,8 +420,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state, j = ctzl(map); map &= ~(1ul << j); memory_region_set_dirty(framebuffer, - (i * width + j) * TARGET_PAGE_SIZE, - TARGET_PAGE_SIZE); + (i * width + j) * page_size, page_size); }; } } @@ -631,17 +640,21 @@ void xen_register_framebuffer(MemoryRegion *mr) void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length) { + unsigned target_page_bits = qemu_target_page_bits(); + int page_size = qemu_target_page_size(); + int page_mask = -page_size; + if (unlikely(xen_in_migration)) { int rc; ram_addr_t start_pfn, nb_pages; - start = xen_phys_offset_to_gaddr(start, length, TARGET_PAGE_MASK); + start = xen_phys_offset_to_gaddr(start, length, page_mask); if (length == 0) { - length = TARGET_PAGE_SIZE; + length = page_size; } - start_pfn = start >> TARGET_PAGE_BITS; - nb_pages = ((start + length + TARGET_PAGE_SIZE - 1) >> TARGET_PAGE_BITS) + start_pfn = start >> target_page_bits; + nb_pages = ((start + length + page_size - 1) >> target_page_bits) - start_pfn; rc = xen_modified_memory(xen_domid, start_pfn, nb_pages); if (rc) { @@ -664,6 +677,9 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp) void arch_xen_set_memory(XenIOState *state, MemoryRegionSection *section, bool add) { + unsigned target_page_bits = qemu_target_page_bits(); + int page_size = qemu_target_page_size(); + int page_mask = -page_size; hwaddr start_addr = section->offset_within_address_space; ram_addr_t size = int128_get64(section->size); bool log_dirty = memory_region_is_logging(section->mr, DIRTY_MEMORY_VGA); @@ -679,8 +695,8 @@ void arch_xen_set_memory(XenIOState *state, MemoryRegionSection *section, trace_xen_client_set_memory(start_addr, size, log_dirty); - start_addr &= TARGET_PAGE_MASK; - size = ROUND_UP(size, TARGET_PAGE_SIZE); + start_addr &= page_mask; + size = ROUND_UP(size, page_size); if (add) { if (!memory_region_is_rom(section->mr)) { @@ -689,8 +705,8 @@ void arch_xen_set_memory(XenIOState *state, MemoryRegionSection *section, } else { mem_type = HVMMEM_ram_ro; if (xen_set_mem_type(xen_domid, mem_type, - start_addr >> TARGET_PAGE_BITS, - size >> TARGET_PAGE_BITS)) { + start_addr >> target_page_bits, + size >> target_page_bits)) { DPRINTF("xen_set_mem_type error, addr: "HWADDR_FMT_plx"\n", start_addr); } From patchwork Sat Mar 9 19:21:42 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: 13587871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C309C54E60 for ; Sat, 9 Mar 2024 19:23:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690981.1076765 (Exim 4.92) (envelope-from ) id 1rj2IP-0005Ni-Ts; Sat, 09 Mar 2024 19:23:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690981.1076765; Sat, 09 Mar 2024 19:23:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2IP-0005NR-Px; Sat, 09 Mar 2024 19:23:49 +0000 Received: by outflank-mailman (input) for mailman id 690981; Sat, 09 Mar 2024 19:23:48 +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 1rj2IO-0000Lp-Lv for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:48 +0000 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [2a00:1450:4864:20::535]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8d0d55fe-de4a-11ee-a1ee-f123f15fe8a2; Sat, 09 Mar 2024 20:23:47 +0100 (CET) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5654f700705so3903295a12.1 for ; Sat, 09 Mar 2024 11:23:47 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id lt10-20020a170906fa8a00b00a45ab830eabsm1179687ejb.51.2024.03.09.11.23.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:46 -0800 (PST) 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: 8d0d55fe-de4a-11ee-a1ee-f123f15fe8a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012226; x=1710617026; 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=ZjbUGqOjGDJ48BD/FCrBKjFot720kk8N7cpG04DHyuw=; b=kbT2qHxTeQyHAtrzgnXBb0Yhs4phmhmYBxX5jYmdvYUaR60c1rt75vUgqpCJ49yDB2 r8ZdfOkw1AJ5k+DwIW//Pw6avF7aqrgPQBOgQmDjoTsovPYDggJUnYORbDwI3O1aO2eK Ye0B33LvKVDWxjklWkBiR/Ruc3cUcRPtNeqol3Jq4UWPdsDffKGl/lBOqBi2kI8rahuE ilyC2KTjjzHHyXX4Ix95kb9/7K3K6FK46mHj7RQtghaf+vmNKoBhJ2BjmCHtoS6R+HNn +w/MOJwbTubXdJ0mvJFG5l5PFTnwpRl/r8Rd5HSAg2l6m6kkUalTfPsUfdoDMMaQ1RZJ WV3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012227; x=1710617027; 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=ZjbUGqOjGDJ48BD/FCrBKjFot720kk8N7cpG04DHyuw=; b=FTEFM/SZYEXL2r0657aFGHm8YVA5yo0LPXNnLCJnlkva2TQC64MvynneycL/q1hoTJ J/+uT12atWspLmuMIqfrrO5PvGm0YvT6xNukrMqxXSt7JoEvQHU7yZUgo5w555I7kXBa 5KvZy7UtJ3DKGi9uRBYnRQVW0s7w9xcfW3CXu3Jc8eXfSUgBVHEa+w3pvCEz/PkH7LIR 8C10/d2LZLelYLMq/1fTpXnMBz7IJApaOPl/z5WTVhv+fmfa1YRTYjuo8i9vpQXI8rvl U0mZIg0GpTWF60YDyJy/pzcMWGSEzY4oQCw5scThVEcYhJOSzlR6Vi40ghOCyGn+qTuu +O7A== X-Forwarded-Encrypted: i=1; AJvYcCV0+WSyO0sNv1hlL3cf0/2T6XbQK6yQkBLIDwPyogFd6R1qalyVvm+IP2r5TQ9OBcwDj1/S6EmiJeIHHoiMowRcZOCT+9W5b0PQ4D8H7ao= X-Gm-Message-State: AOJu0YxnLooYvgbPRIS7IwR6HDgY6JDwN17Un9K2ysbGid10IJszhhjr 4KsG8m0gnOEBUxumswW72Dnjqps+z2OZzUmBLP3CDRlepguVH9quU6sqQHQSkVudw2N1bZR+an0 j X-Google-Smtp-Source: AGHT+IHsirtIOeTRkWpIs3e5yCTD71AujDzccS4QPk7Rv1bmDdnDigFagjmowzpwOIomavcvEpokKQ== X-Received: by 2002:a17:906:b0d0:b0:a44:8c1b:8877 with SMTP id bk16-20020a170906b0d000b00a448c1b8877mr1523044ejb.50.1710012226664; Sat, 09 Mar 2024 11:23:46 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Stefano Stabellini , Anthony Perard , Paul Durrant , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , xen-devel@lists.xenproject.org Subject: [PULL 15/43] hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend() Date: Sat, 9 Mar 2024 20:21:42 +0100 Message-ID: <20240309192213.23420-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 From: Zhao Liu As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD(): * = Why, when and how to use ERRP_GUARD() = * * Without ERRP_GUARD(), use of the @errp parameter is restricted: ... * - It should not be passed to error_prepend(), error_vprepend() or * error_append_hint(), because that doesn't work with &error_fatal. * ERRP_GUARD() lifts these restrictions. * * To use ERRP_GUARD(), add it right at the beginning of the function. * @errp can then be used without worrying about the argument being * NULL or &error_fatal. ERRP_GUARD() could avoid the case when @errp is the pointer of error_fatal, the user can't see this additional information, because exit() happens in error_setg earlier than information is added [1]. The xen_console_connect() passes @errp to error_prepend() without ERRP_GUARD(). There're 2 places will call xen_console_connect(): - xen_console_realize(): the @errp is from DeviceClass.realize()'s parameter. - xen_console_frontend_changed(): the @errp points its caller's @local_err. To avoid the issue like [1] said, add missing ERRP_GUARD() at the beginning of xen_console_connect(). [1]: Issue description in the commit message of commit ae7c80a7bd73 ("error: New macro ERRP_GUARD()"). Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paul Durrant Cc: "Marc-André Lureau" Cc: Paolo Bonzini Signed-off-by: Zhao Liu Acked-by: Anthony PERARD Message-ID: <20240228163723.1775791-15-zhao1.liu@linux.intel.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/char/xen_console.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index 5cbee2f184..683c92aca1 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -206,6 +206,7 @@ static bool con_event(void *_xendev) static bool xen_console_connect(XenDevice *xendev, Error **errp) { + ERRP_GUARD(); XenConsole *con = XEN_CONSOLE_DEVICE(xendev); unsigned int port, limit; From patchwork Sat Mar 9 19:21:43 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: 13587872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6185DC54E60 for ; Sat, 9 Mar 2024 19:24:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.690982.1076775 (Exim 4.92) (envelope-from ) id 1rj2IU-0005mP-7T; Sat, 09 Mar 2024 19:23:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 690982.1076775; Sat, 09 Mar 2024 19:23:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rj2IU-0005mG-2U; Sat, 09 Mar 2024 19:23:54 +0000 Received: by outflank-mailman (input) for mailman id 690982; Sat, 09 Mar 2024 19:23:53 +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 1rj2IT-0001PG-KJ for xen-devel@lists.xenproject.org; Sat, 09 Mar 2024 19:23:53 +0000 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [2a00:1450:4864:20::62e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 90a0bd32-de4a-11ee-afdb-a90da7624cb6; Sat, 09 Mar 2024 20:23:53 +0100 (CET) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a45bb2a9c20so389479566b.0 for ; Sat, 09 Mar 2024 11:23:53 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.237]) by smtp.gmail.com with ESMTPSA id k5-20020a170906578500b00a449ebf3d58sm1178448ejq.85.2024.03.09.11.23.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 09 Mar 2024 11:23:52 -0800 (PST) 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: 90a0bd32-de4a-11ee-afdb-a90da7624cb6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710012233; x=1710617033; 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=0qhkX9N0f7mv4U6Enm7PREVuXkmrXKzBrsiRapOf0sE=; b=lgdBTmbi/sBA8OH1UM4YfGlOYFOjwWc159O0HgOayc1yO3kClIVB8LTSqPfZydHHVi v6x301MY+QMF1NMPH6JAOQaIgWQQrlpc8I81sdMbF0fUrGzShsKL1/wk2Y3AhVlwTXaW hc8AAdCyxWxn03G9Fws75WOyM5hVDPLtIUu5JjbBc/GpJa245KHu+EEyRwGkNJmd3mf2 RB0a4omrDd/X9e35PnhMkcLszH54sL/5tTlPpEJyPX9jkwk/v2nIiCaxx8Q8lJ6fq7UV 1ZtYvN4ktPd179rhrRr9I+J5134I7Be8aV1LVrwQT7AmdQdME+H/bNQqNjd4ZE/k/qQe W1XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710012233; x=1710617033; 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=0qhkX9N0f7mv4U6Enm7PREVuXkmrXKzBrsiRapOf0sE=; b=n9nGnTLQK3yUFDedsNDbX6DXHWe4OGi/9mjXZNTS/hdaSYizd6r9anCzRm1OT6kk8K szPTdXSK5LCNoXhBDU64YaCa7TKjG/hyGKcU068cheM3hOe5XVjDlaUbbYGKYojvYC3V sysKxW8Z17SgnBBKHRCVfWjaio5vYsyBtJ+8EarSXOEd9SFC/V0A90Ns0qOZwmRf+a64 QbaYdw6JV6z4mRo7GX6JpQTUHYoO2QGKkJqRED9ZC00SSul4ecAcWEH3HoRW3Hx/fESA r9tS90BLm48xQeyVkAw49Y8glsI2H3bbKG6fxGp2h7oowLDk2GihK8G+SuColxZ7f/QY YUvA== X-Forwarded-Encrypted: i=1; AJvYcCW6rFlEyPbkSQ8mOXdhZFB0FyiepOs7ip3c4xVBFtQVRvuR2hx3zNWPDechmxgGs6yDIlUSUfbiK2VZFH9f9tuSc466GTo6PZGu2qY2Nmw= X-Gm-Message-State: AOJu0YxKvz9LLTdZKcAk2AQEzcZ+BCy2VhNgd+IqHkU5bbVMJJazy2wV ExZxfhIo/3mn4U5KC5byZbbVjjvxaoLdB2xfpY6HNFr78jDB2L8URurfMWagZRg= X-Google-Smtp-Source: AGHT+IE0pC1PtPPUFeJGmL9nn03Tms40CF9fkNhPdedtB8UjjmtZf/tpA8FjVipfHktzZdaLWkMqpQ== X-Received: by 2002:a17:907:c28a:b0:a43:900a:31c5 with SMTP id tk10-20020a170907c28a00b00a43900a31c5mr1698253ejc.4.1710012232757; Sat, 09 Mar 2024 11:23:52 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, Zhao Liu , Stefano Stabellini , Anthony Perard , Paul Durrant , Jason Wang , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , xen-devel@lists.xenproject.org Subject: [PULL 16/43] hw/net/xen_nic: Fix missing ERRP_GUARD() for error_prepend() Date: Sat, 9 Mar 2024 20:21:43 +0100 Message-ID: <20240309192213.23420-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240309192213.23420-1-philmd@linaro.org> References: <20240309192213.23420-1-philmd@linaro.org> MIME-Version: 1.0 From: Zhao Liu As the comment in qapi/error, passing @errp to error_prepend() requires ERRP_GUARD(): * = Why, when and how to use ERRP_GUARD() = * * Without ERRP_GUARD(), use of the @errp parameter is restricted: ... * - It should not be passed to error_prepend(), error_vprepend() or * error_append_hint(), because that doesn't work with &error_fatal. * ERRP_GUARD() lifts these restrictions. * * To use ERRP_GUARD(), add it right at the beginning of the function. * @errp can then be used without worrying about the argument being * NULL or &error_fatal. ERRP_GUARD() could avoid the case when @errp is the pointer of error_fatal, the user can't see this additional information, because exit() happens in error_setg earlier than information is added [1]. The xen_netdev_connect() passes @errp to error_prepend(), and its @errp parameter is from xen_device_frontend_changed(). Though its @errp points to @local_err of xen_device_frontend_changed(), to follow the requirement of @errp, add missing ERRP_GUARD() at the beginning of this function. [1]: Issue description in the commit message of commit ae7c80a7bd73 ("error: New macro ERRP_GUARD()"). Cc: Stefano Stabellini Cc: Anthony Perard Cc: Paul Durrant Cc: Jason Wang Signed-off-by: Zhao Liu Acked-by: Anthony PERARD Reviewed-by: Thomas Huth Message-ID: <20240229143914.1977550-3-zhao1.liu@linux.intel.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/net/xen_nic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c index 453fdb9819..89487b49ba 100644 --- a/hw/net/xen_nic.c +++ b/hw/net/xen_nic.c @@ -351,6 +351,7 @@ static bool net_event(void *_xendev) static bool xen_netdev_connect(XenDevice *xendev, Error **errp) { + ERRP_GUARD(); XenNetDev *netdev = XEN_NET_DEVICE(xendev); unsigned int port, rx_copy;