From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCD5FC47082 for ; Thu, 3 Jun 2021 12:41:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4C2A0613DE for ; Thu, 3 Jun 2021 12:41:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C2A0613DE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:49568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lomet-0007gV-3P for qemu-devel@archiver.kernel.org; Thu, 03 Jun 2021 08:41:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lomdW-0006W9-Bf for qemu-devel@nongnu.org; Thu, 03 Jun 2021 08:39:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lomdO-0001x4-KV for qemu-devel@nongnu.org; Thu, 03 Jun 2021 08:39:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622723976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tdqHVmVflfqyxt27O1b6+VXH2djfui6Z/YNcJOL9zrU=; b=dtEfB4UmoCuZZp+zho8irxyKRoOzHTK62Ob0E1xnLauI4ipC9a97l1mFpcGLiikAbDmJTZ s9UlNS8H7exwrwCEtOv637yLSWhghvEKnvx9qkDIkdpGwXb24bUUVZRTj7eOi9lVOPODCj bVQkIMH2QG9e3KNr0GOXJgKZNvUYnBc= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-587-T-cpWVAcPRiJl9aGr8WMSA-1; Thu, 03 Jun 2021 08:39:34 -0400 X-MC-Unique: T-cpWVAcPRiJl9aGr8WMSA-1 Received: by mail-ed1-f71.google.com with SMTP id d8-20020a0564020008b0290387d38e3ce0so3197794edu.1 for ; Thu, 03 Jun 2021 05:39:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tdqHVmVflfqyxt27O1b6+VXH2djfui6Z/YNcJOL9zrU=; b=LCE1bUXP2YNj2QcdL48NOLgYPo4oz3RWM1f2hOY1k8UTTGUHYEuDkFID7eD2vnSlu5 JBzRkPJ5znDrnJAJ2WpAYYzzEoSUxCdhwpXnPK9wwVtRlmAS0ts4Umb2PkMPh0sv+K2I 4Pa5E5kbMQ590+vUlo1ZwMxBFxBAJ5MuHQEz2nnZJhJKB35aJx9WDgGqoj8ICHg2Mltc R2yiQmspHaMRG1toEr/rr9txqjBz0ozteHdv05PypQsH7ibr3PvLROTgoAfqsK80q6ec sY2QvIkE1xyRuAZ7Pyko9jP88qmBOfAmEzQtB/rAq3C1t/CVNNpNoO4aN27y+hYntAN0 f1HA== X-Gm-Message-State: AOAM531yokas8yISovD7cxMWvGK8l42NIBNjzlpqTxVliZcyzk62QuLP +zdxrzOsS0ojxOAT97/eqtgH9miyIHdNLfGweLVADiNvSUWGpoX+NHeRoa0aDa7LtP1sRNzUNw6 G23eWY1LJEZQpaFVKSSrerde4Q24Jj2UwynNCMS9Zp9RnRoWVvoJmMRcWLrT2EVxe X-Received: by 2002:a17:907:1ca9:: with SMTP id nb41mr39071022ejc.279.1622723973128; Thu, 03 Jun 2021 05:39:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1499tuZqGhA4ARasMjhZ9QjVToLdv5A5mwFZXTvdh7tzuvbGtML4+jbLrwYvV1GSzWNZlDw== X-Received: by 2002:a17:907:1ca9:: with SMTP id nb41mr39071011ejc.279.1622723972852; Thu, 03 Jun 2021 05:39:32 -0700 (PDT) Received: from [192.168.1.36] (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id a97sm1763578edf.72.2021.06.03.05.39.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 05:39:32 -0700 (PDT) Subject: Re: [PATCH] hw/intc/arm_gicv3_cpuif: Tolerate spurious EOIR writes To: Jean-Philippe Brucker , peter.maydell@linaro.org References: <20210603110012.1182530-1-jean-philippe@linaro.org> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: <31c4e422-5451-3c0a-f5e6-df75559c9a9b@redhat.com> Date: Thu, 3 Jun 2021 14:39:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210603110012.1182530-1-jean-philippe@linaro.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.37, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.603, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hi Jean-Philippe, On 6/3/21 1:00 PM, Jean-Philippe Brucker wrote: > Commit 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access > check logic") added an assert_not_reached() if the guest writes the EOIR > register while no interrupt is active. > > It turns out some software does this: EDK2, in GicV3ExitBootServicesEvent(), > unconditionally write EOIR for all interrupts that it manages. This now > causes QEMU to abort when running UEFI on a VM with GICv3. Although it > is UNPREDICTABLE behavior and EDK2 does need fixing, the punishment > seems a little harsh, especially since icc_eoir_write() already > tolerates writes of nonexistent interrupt numbers. Simply ignore > spurious EOIR writes. > > Fixes: 382c7160d1cd ("hw/intc/arm_gicv3_cpuif: Fix EOIR write access check logic") > Signed-off-by: Jean-Philippe Brucker > --- > hw/intc/arm_gicv3_cpuif.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c > index 81f94c7f4a..1d0964c9bf 100644 > --- a/hw/intc/arm_gicv3_cpuif.c > +++ b/hw/intc/arm_gicv3_cpuif.c > @@ -1357,7 +1357,8 @@ static void icc_eoir_write(CPUARMState *env, const ARMCPRegInfo *ri, > } > break; > default: > - g_assert_not_reached(); > + /* No interrupt was active, this is UNPREDICTABLE. Ignore it. */ A qemu_log_mask(LOG_GUEST_ERROR, ...) call here could be useful, do you mind adding it? > + return; > } > > icc_drop_prio(cs, grp); >