From patchwork Mon Jul 3 18:31:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 698727 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp1891157wrs; Mon, 3 Jul 2023 11:34:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QRydh5/RZ/EsQ3dV1OBc7sNG3iizFG5aj+U9VnCBbmyOs0Rtk9Q62lgL5xlGubHn7s5UC X-Received: by 2002:ac8:5e4b:0:b0:400:7b48:3cb8 with SMTP id i11-20020ac85e4b000000b004007b483cb8mr15264241qtx.5.1688409273160; Mon, 03 Jul 2023 11:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688409273; cv=none; d=google.com; s=arc-20160816; b=zrqem/VR614IFKZHO+cGa2bBqdIsH2ExsA6MB5IqY6wk/mswOiAwys9vUMPDli/c/3 XDJuEsf2hja1w5CHqrGNfWPgQqGQUPdl9QZn0RdXspN91YZAb1Aox94Jm7dSsGApWBr6 JUITiMsEcKBIo9SaVDqB3io8ndHtcU2n55ZxhQMmd8BYlL1K+/uWFzY9BM57mqVFEdxH g/AfFQds2BkfDEz6G5B0S8uf3Zg06BGm3WQe2fEu3hzGkZ73IPlGw+4zAeDHNetGuqG7 z4ssUgQJz0vWVsyzOJwJbRWRLMTiLi9W6JOhsfgNnmCdBT920FH5ICiPiiEXKKuwW1t1 iK0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tMsBShz4C7A1YrSDPbppIGD5ps17qyWqJYLBfgbzYNs=; fh=vvMppja281vKOzNTqm/8B9R+cnANR9RxW7IMPTmCJ4Q=; b=N0zgCjlzXWoxVZMlylHgLYbi0qtFNEuHKV6IXpAINW1bplQ/sWEHvjEj76CDC5iimh hqr7Ug5nglXaDDTZp1AqgB/VYm9Qkz1aEryPxMNq6JeNiAg17MOwzuyFiqXBlHLjzkrx F9+OIFFr6I5djt8+nNpIsBm27y32fw5VqsXJ9Gx4/AyzLnA63PGa+85MDQpoAij5PEKq kV4pOlrq15tKEw7jMt+h3XtClQa19JLNKk5qUBfNYjrVJjsY9OWoVzIFRgqMUw6k7yFA bI86VH/SW2RsaId/rL2Yf6k+cPJO8sFWitqM0sYtMRugH7pwkYh4ppfFhPbb2ID9Hhnb 21JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BC+SB7mn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v17-20020a05622a015100b0040368ec74b1si714386qtw.578.2023.07.03.11.34.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jul 2023 11:34:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BC+SB7mn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGOLA-0007aM-4R; Mon, 03 Jul 2023 14:32:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGOL8-0007Zb-6X for qemu-devel@nongnu.org; Mon, 03 Jul 2023 14:31:58 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qGOL6-00007y-C5 for qemu-devel@nongnu.org; Mon, 03 Jul 2023 14:31:57 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-311367a3e12so6315374f8f.2 for ; Mon, 03 Jul 2023 11:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688409115; x=1691001115; 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=tMsBShz4C7A1YrSDPbppIGD5ps17qyWqJYLBfgbzYNs=; b=BC+SB7mnKNlR4pjYmT6LyjDiL3lYJfs2d1mxokhx86DjKVqazk7dx5Xza9vPiq7mei o3TzBlYH9DwrvGlDD8qMMno0izkWU9Fio2scqV3u6aF+YaURAfNvYk8cglpAJXiukuOr br6xhOGLEQTSdMXjrTm4cYPDHfJxUkrCkDh5dW/ZiDnOA1Z3IkIpjJiIZt0ixl0sJKOH 6e61kZud+2TeRQx5cC62d+i0iuoyJ8kZRO8plfMwtyYIU0S1MTg1OH0yKB0hW8kB3z1Y pJRIc20NBYxuhMgpdtdIoKrIzuFCjZe+UR96E/7sqZpFCv+Js6prCUgI1LB2h9sOUFzM EqzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688409115; x=1691001115; 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=tMsBShz4C7A1YrSDPbppIGD5ps17qyWqJYLBfgbzYNs=; b=kJlEgbGUYfA0Z+mOf54mVI39BODmjlkf92/NFMdHXzI+nrWd1SRmmQX3cjRXps4hew 2YPr/+huRzI90KvEcsF+oFHDPSjvP0CIl7S0f+BDe6ti0AFQt6GTTsFL0+r6jQeuu0pe mpJS8hM98S6iHb/nomp+S1MiZoY/BjFxBhVVHv8piNzmpJZmVo1w+k0/L5IsFqXFhRFN CTVOTuaueswmTnDBXPsTxfyso6sUIUvrDuD1gFkHMJm1tq7uSJcW4palbWgI4448xs4L dmxydGyfCeKQZKnG7SnIqeNqKSm+GjPdJXhd30UX4BCdSj7GsyUorszOsBjzMjz3F7AX nE8Q== X-Gm-Message-State: ABy/qLYG9qA7EvJpjx15DVWccwj02bmXSrxYjSRQdWdn9fTzq853LKMI HpF8m0/jWgzIL2L0rID6lbEuQ3fFSlUXwRTJ3fMLzw== X-Received: by 2002:a05:6000:1152:b0:314:2b0a:dac6 with SMTP id d18-20020a056000115200b003142b0adac6mr6770036wrx.41.1688409114864; Mon, 03 Jul 2023 11:31:54 -0700 (PDT) Received: from localhost.localdomain ([176.176.178.91]) by smtp.gmail.com with ESMTPSA id u11-20020adfdd4b000000b003143765e207sm3323297wrm.49.2023.07.03.11.31.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 03 Jul 2023 11:31:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Palmer Dabbelt , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Beraldo Leal , Wainer dos Santos Moschetta , Alistair Francis , Daniel Henrique Barboza , kvm@vger.kernel.org, qemu-riscv@nongnu.org, Bin Meng , =?utf-8?q?Alex_Be?= =?utf-8?q?nn=C3=A9e?= , Weiwei Li , Liu Zhiwei Subject: [PATCH v2 01/16] target/riscv: Remove unuseful KVM stubs Date: Mon, 3 Jul 2023 20:31:30 +0200 Message-Id: <20230703183145.24779-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230703183145.24779-1-philmd@linaro.org> References: <20230703183145.24779-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since we always check whether KVM is enabled before calling kvm_riscv_reset_vcpu() and kvm_riscv_set_irq(), their call is elided by the compiler when KVM is not available. Therefore the stubs are not even linked. Remove them. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel Henrique Barboza Tested-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis --- target/riscv/kvm-stub.c | 30 ------------------------------ target/riscv/kvm.c | 4 +--- target/riscv/meson.build | 2 +- 3 files changed, 2 insertions(+), 34 deletions(-) delete mode 100644 target/riscv/kvm-stub.c diff --git a/target/riscv/kvm-stub.c b/target/riscv/kvm-stub.c deleted file mode 100644 index 4e8fc31a21..0000000000 --- a/target/riscv/kvm-stub.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * QEMU KVM RISC-V specific function stubs - * - * Copyright (c) 2020 Huawei Technologies Co., Ltd - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2 or later, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -#include "qemu/osdep.h" -#include "cpu.h" -#include "kvm_riscv.h" - -void kvm_riscv_reset_vcpu(RISCVCPU *cpu) -{ - abort(); -} - -void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level) -{ - abort(); -} diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c index 0f932a5b96..52884bbe15 100644 --- a/target/riscv/kvm.c +++ b/target/riscv/kvm.c @@ -503,9 +503,7 @@ void kvm_riscv_reset_vcpu(RISCVCPU *cpu) { CPURISCVState *env = &cpu->env; - if (!kvm_enabled()) { - return; - } + assert(kvm_enabled()); env->pc = cpu->env.kernel_addr; env->gpr[10] = kvm_arch_vcpu_id(CPU(cpu)); /* a0 */ env->gpr[11] = cpu->env.fdt_addr; /* a1 */ diff --git a/target/riscv/meson.build b/target/riscv/meson.build index 7f56c5f88d..e3ab3df4e5 100644 --- a/target/riscv/meson.build +++ b/target/riscv/meson.build @@ -22,7 +22,7 @@ riscv_ss.add(files( 'crypto_helper.c', 'zce_helper.c' )) -riscv_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c')) +riscv_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c')) riscv_system_ss = ss.source_set() riscv_system_ss.add(files(