From nobody Thu Nov 21 16:30:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1724835664; cv=none; d=zohomail.com; s=zohoarc; b=RDfUodN4zEjoxaAtWZnL0UrQLC9xR+Z6PzGwIekAQkyXIDYfI6KYG6ANv9gPMMI8Z4zpsMB6SAhp/j1Sew4FcFkUadSSm9egQblm/lGrPmfE1ZsLJXi6mtSBtDYZwJHWhd8s2alcAXGcjEC4+b4HeJ/rEcpT4VzZICyx9h77Z2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724835664; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IDlXVI4tN1z7T+KNMK8D/vgvXHZ0aqeWrPhpeNr3oGI=; b=cKsF0ZrpI5OBr9Ki2SCMJiOVZ9C5ASWqpgAKX+M9jpDaT3A8jQ/iEpEFUPyszc8QO4DqnQDiPiirfYJk19/j29hBlFbF4pZD84NdptROZRO6Ca/NAeQsJlSKDfr1FEfy4xrlL8uZ2elqAjiU4uu+8f0b4Y86x26l1oNWZe73Wt8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1724835664736551.7602975271649; Wed, 28 Aug 2024 02:01:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.784553.1193920 (Exim 4.92) (envelope-from ) id 1sjEXa-0000tn-Ld; Wed, 28 Aug 2024 09:00:34 +0000 Received: by outflank-mailman (output) from mailman id 784553.1193920; Wed, 28 Aug 2024 09:00:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjEXa-0000tg-Hh; Wed, 28 Aug 2024 09:00:34 +0000 Received: by outflank-mailman (input) for mailman id 784553; Wed, 28 Aug 2024 09:00:33 +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 1sjEXZ-0000ta-Np for xen-devel@lists.xenproject.org; Wed, 28 Aug 2024 09:00:33 +0000 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [2a00:1450:4864:20::632]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fab0c2d2-651b-11ef-99a0-01e77a169b0f; Wed, 28 Aug 2024 11:00:31 +0200 (CEST) Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a868d7f92feso822691166b.2 for ; Wed, 28 Aug 2024 02:00:31 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a86e594a545sm212828166b.205.2024.08.28.02.00.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Aug 2024 02:00:30 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: fab0c2d2-651b-11ef-99a0-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1724835631; x=1725440431; darn=lists.xenproject.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=IDlXVI4tN1z7T+KNMK8D/vgvXHZ0aqeWrPhpeNr3oGI=; b=ah7AC7Zl23ipu5eq4c5/0ncSewAz+AsIDt7RpttT3A00tHTu/fHT0JtshmAyazk1wi TEACT8x4qyL+UZcFaTKz+fsLg5Bvsjt/M5/I9dxPcUpuhhX3RvrKqCHl1LTSd0I3kDDM kdffRlIwqzb+w8RFQn+Z4BkE3P53bHrpDx0/RLDUrHfiusm75uD0wK8aOZzn1ogObsto mWDk9YF4vxKtEq3K10cFICk/HpOlaEOyqM7aCR0HgsYKyRFIQ3ORtaiaSr8u4G91GP9u gCeOCCTl/YsAVQFMwNEAR5ryzpJ+9TzfJOemV24CId6BYDInZwAh9t6Zmt+b5cxD4f1g w6Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724835631; x=1725440431; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IDlXVI4tN1z7T+KNMK8D/vgvXHZ0aqeWrPhpeNr3oGI=; b=h/2Vu/CjeGouE5OLRyyHnbGwNNc0QcUHXxHYwvHus+Ippv7eRfHxsfWuzpJqSei4Eo jkOndh5f68n8umhU2e+EV/drU7W5n27Bm+WCRGaYRYrl+G86N6YyeR+WLZQMs8KlFnuJ wCnXS/TW6qZV0baiKsTNSsJ38WZHckH6B6rb4807KvDivWugmY4lzob9YAjCmxk5yTh4 oLlDWyycU29E45x0jzmL+eWowE7XBJb+31zxtRsnXxkZ8ssAZ6VmqmWs2Aa6bo3oPPSf LVZzBmBFS+G2lxGpOxml4Of0ke4Fz3eDMfbnZwJ6XNoxETfWKV9hsRrpKtQkdFRbezRV 70IQ== X-Gm-Message-State: AOJu0Yy9Pb/YplcrwRFAs+651+xvtwJ1RBCDgYJs78HWOL1NwgrRM60U wPs1pgG0X7p2eRWxvx/s1VJJx3kG95oNl2an+0eyHoT6jyZOSPAwND9NFyphzg7j8emrGfaLB4g = X-Google-Smtp-Source: AGHT+IGHpx7Xudff8ARLDevvbz3QNV7fJG1J76Ibn5Mnv56P9WECyyj73XMjM7T7Gsm5H0pq4MV8+w== X-Received: by 2002:a17:907:9724:b0:a86:95ff:f3a0 with SMTP id a640c23a62f3a-a86a5188d5fmr1133283866b.3.1724835631012; Wed, 28 Aug 2024 02:00:31 -0700 (PDT) Message-ID: Date: Wed, 28 Aug 2024 11:00:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= From: Jan Beulich Subject: [PATCH] x86/HVM: correct partial HPET_STATUS write emulation Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3N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MQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1724835666404116600 Content-Type: text/plain; charset="utf-8" For partial writes the non-written parts of registers are folded into the full 64-bit value from what they're presently set to. That's wrong to do though when the behavior is write-1-to-clear: Writes not including to low 3 bits would unconditionally clear all ISR bits which are presently set. Re-calculate the value to use. Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts= ") Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- Alternatively we could also suppress the folding in of read bits, but that looked to me to end up in a more intrusive change. --- a/xen/arch/x86/hvm/hpet.c +++ b/xen/arch/x86/hvm/hpet.c @@ -404,7 +404,8 @@ static int cf_check hpet_write( break; =20 case HPET_STATUS: - /* write 1 to clear. */ + /* Write 1 to clear. Therefore don't use new_val directly here. */ + new_val =3D val << ((addr & 7) * 8); while ( new_val ) { bool active;