Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1337455lqd; Thu, 25 Apr 2024 12:18:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVnPjfo91oQ5Doh8WLSKFHk7OFhfnMYA6idBufp+PzzPRxlPrt65Pqb/wACIynRTxdOU5o+cJn1LSZPoTaELFkzDDUFlw6fUnwstPcoEg== X-Google-Smtp-Source: AGHT+IG56N6iooq9V5zxMKH636+rCen0fBFV8MMjhf0b4kYAYBOU9OuW7w5vkB9P7dZ++leaWAKq X-Received: by 2002:a50:8d1d:0:b0:56d:c88a:f37 with SMTP id s29-20020a508d1d000000b0056dc88a0f37mr347522eds.26.1714072728305; Thu, 25 Apr 2024 12:18:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714072728; cv=pass; d=google.com; s=arc-20160816; b=ndW2CWfU4St6cI/hGSH25AN5iIU53Vz31EHnRIoYAZrrobtS5JSehMEm5lhslbb96z WkV3OWa1Yz50xTEAUU6vTNYxXfiSuVGMY6HXJokiw2YCnxsQtbzNDi28FAFOP299JceJ jZHZ7fUAfd4Zd4AueiXIfkGhXOwjE1QcG5ah6j0liBAPe3sMYdw7uJgZUrm2V0P8WvNc nqSFnSBVZx0DJksIP1+GGl3d3qkoULEREPu71Or4avXjHBOpeyNqOPj6FueXjNaVGn/2 ur+uFCVb0d2MrNGQwx9fVPxmvYSP0aX3Gi1tzloeLBnrW+hE1ycrYxQGBQzQIys4QPIi YIMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=ev52rMR4Q4Woczb+9iTzXyh9tVmc6K3sVmdOuWpY6dU=; fh=Hbaraxwmn7wGwGduda88+v9TqdHRGSY9DSQeqe6Y77E=; b=IS/PEdWbYElBA1vVGaVfVJmS0kks3Jgqq2KETIpzpsLJu3sHEybPiYy58Ht1NpWno0 acVNo00XKjuRq/2eC6a30TneVMO4iI6RiIzvg6bwAqVolMxBjQsbDsI6gFueLDkFlCmT 7TTs3n8TVKGn5WBwq/29hR/rMHLH1TC3l3/KmVUod3OK6YyZMJ3tySU6c+acrzXlnSCK TQmuCocQ+AVCqM//JwX02HrcugWMJ9HRPAuIFWYyleTCWHf+6UHOnZGMw+0XCQb6pyMT EPuU8YnvtclndF55sbgp07LVuic8hQdcdn1mBKoyKQPdTIu5MNOlh941GZ2Y5AI3jUw+ tt3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NLaMPAaD; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-159072-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159072-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e7-20020a056402190700b005720c6299f7si6052411edz.312.2024.04.25.12.18.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 12:18:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159072-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=NLaMPAaD; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-159072-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159072-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 078DE1F23CE0 for ; Thu, 25 Apr 2024 19:18:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4449A152191; Thu, 25 Apr 2024 19:18:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="NLaMPAaD" Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5EB72135A for ; Thu, 25 Apr 2024 19:18:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714072718; cv=none; b=TWvxPRtctpFUCWpA/W31QKPqZ58pnESv2nZK4CmgZkMXqo9QS/f3hpdFjUf0IIJGAwCuVm183TIX1X9nbceeiAA5IfxYAI0V4wHkOCsigBEkBjbUhAGj5y6bQCZ/pshxcG9VkuMgCCVGMS0sRmiVdBrdE6XjFh2JfGbtf3Tke1k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714072718; c=relaxed/simple; bh=9SMxCSKhvmc+6oVvqLR1AsFgyVSziSQPD4cUWIChFV0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=OlrVBK+bQHYDi1K1U/A7iOj/Qs/fSYjIVCG7RegPN0YC66MXfRIKDm5yhdfWAsI1+nwud83Bd7W59VMozaRo+F8IYo2JghvtCb179LuwW1SPosDYiX2jzPv62qf/vp0OE7iASRh9I2RyVmjXrocFuam0OkxCXbUHxCIIuUw2cAM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=NLaMPAaD; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-571c22d9de4so2093888a12.3 for ; Thu, 25 Apr 2024 12:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1714072714; x=1714677514; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ev52rMR4Q4Woczb+9iTzXyh9tVmc6K3sVmdOuWpY6dU=; b=NLaMPAaDAfWyAjYqlc8UoygSIrawsyKNAlA7ESSWqmOyuD7gYLHRVsXShcg27laH8C nrJd6Nj6G8fx4R8h0a8lGW4sjlZ9kMbuxbjuZPoDCVrR4Sw84QIFhpBf3t6MTgRss3lj taDq8/QEE0XVuwzqEDWPUP3Xc4yEjWjtvE2Mc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714072714; x=1714677514; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ev52rMR4Q4Woczb+9iTzXyh9tVmc6K3sVmdOuWpY6dU=; b=hG3+sKgBouyINCAfgDM43hq/Ps6eUN8vJslSfc9CYH9FQTD9071JXPD0Nu0xiWq7n6 1t5uCTc3lHVEkvj2pkXyKr0TQmchosvw7t/LDcJHTXnxEAlux6z88hFoG2t3s32+6Gm2 jAIdR4be+u5tqDxdYx/tk0OWz5+eETUcJI6WEMOMHETBemvstxONEgPzQ6Is9JO5Z8hD Tz54w9X7g5s5cGN8BBc5b/HFjfsTLSTIMkBdwWVk4bAfl6dJVlr+tiWf6/ijLFXCtE6e ejP14ko76cfRdKZTb728a1Xh8V2br1+OeWyeItaOlLlWIUxw2V6Rg2uN7nokEhExfEGl SrPA== X-Forwarded-Encrypted: i=1; AJvYcCULQS6INEh+IhifKgRZKgdutTs6dadwu7eYh+Z/bviDXg7JzvqQqdjpTsChGAk28bmVa+csATlVi4XrSY0I2B+IUeFQsI00/5HTwQZK X-Gm-Message-State: AOJu0YwhKhrnFYTlaPfbZtzKsYYwLn5eZUq4VfjaYVEH04YQqoerON6w 8ph1+X2YmnL/ac77disU7/sSwnBKFSpX3vwj+5nqq2NZc9bnzZsE1z934JMhHojc92A7lZKsj4F s2I+ixw== X-Received: by 2002:a17:906:3102:b0:a55:aeb0:cb22 with SMTP id 2-20020a170906310200b00a55aeb0cb22mr537592ejx.9.1714072714451; Thu, 25 Apr 2024 12:18:34 -0700 (PDT) Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com. [209.85.218.41]) by smtp.gmail.com with ESMTPSA id mc11-20020a170906eb4b00b00a5256d8c956sm9764353ejb.61.2024.04.25.12.18.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Apr 2024 12:18:33 -0700 (PDT) Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a51a7d4466bso161182366b.2 for ; Thu, 25 Apr 2024 12:18:33 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCXjCW6H7cbq56SiGGBNZA4u5FgHfpYPa0MyvCBGaQtJQOx5GTIiH75Y0gf1xppNkAnkxZFHDkCJdgE8Qb9QlmQ4kF2CdmnBPImUA5Tj X-Received: by 2002:a17:906:1345:b0:a4e:cd5c:da72 with SMTP id x5-20020a170906134500b00a4ecd5cda72mr421167ejb.63.1714072713361; Thu, 25 Apr 2024 12:18:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Thu, 25 Apr 2024 12:18:17 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] ACPI fixes for v6.9-rc6 To: "Rafael J. Wysocki" , Jarred White Cc: ACPI Devel Maling List , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" On Thu, 25 Apr 2024 at 11:58, Linus Torvalds wrote: > > And maybe this time, it's not a buggy mess? Actually, even with MASK_VAL() fixed, I think it's *STILL* a buggy mess. Why? Beuse the *uses* of MASK_VAL() seem entirely bogus. In particular, we have this in cpc_write(): if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) val = MASK_VAL(reg, val); switch (size) { case 8: writeb_relaxed(val, vaddr); break; case 16: writew_relaxed(val, vaddr); break; ... and I strongly suspect that it needs to update the 'vaddr' too. Something like if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { val = MASK_VAL(reg, val); #ifdef __LITTLE_ENDIAN vaddr += reg->bit_offset >> 3; if (reg->bit_offset & 7) return -EFAULT; #else /* Fixme if we ever care */ if (reg->bit_offset) return -EFAULT; #endif } *might* be changing this in the right direction, but it's unclear and I neither know that CPC rules, nor did I think _that_ much about it. Anyway, the take-away should be that all this code is entirely broken and somebody didn't think enough about it. It's possible that that whole cpc_write() ACPI_ADR_SPACE_SYSTEM_MEMORY case should be done as a 64-bit "read-mask-write" sequence. Possibly with "reg->bit_offset == 0" and the 8/16/32/64-bit cases as a special case for "just do the write". Or, maybe writes with a non-zero bit offset shouldn't be allowed at all, and there are CPC rules that aren't checked. I don't know. I only know that the current code is seriously broken. Linus