Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp867353pxj; Fri, 14 May 2021 19:08:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPyxObqvkskG2fDG0BCtjlCuPhrMBSjS8ErN42HJNmp1c0BuhUFvIRqTgceFnlWLbnUNZ9 X-Received: by 2002:a6b:f212:: with SMTP id q18mr37025856ioh.131.1621044498686; Fri, 14 May 2021 19:08:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621044498; cv=none; d=google.com; s=arc-20160816; b=Qv1OQ5ax60iVn9BQh9/cReiBKjh+sP/ELocyl8h9kPeQ9BmjIO+LGdmRLoMDaqBOya geTB97gbdQi29oRxIJBn+sNHXQ0DuJqXuAYaeihZ8nRBgi/uo3u6XWOyxqrxH5Cijhcm kc8H3Kf8TUTC2dXvvNuc2zwUiF0kgj3QiAs7d846qThoDM5MwROKXD2RPHjmFYCqEbtx Kw4O5KyLDquareba9hbt81ZL6GZhyvy7i8Wfg/iRQ4RmTBSsex1b5UjyNG33rDkCCagg 9l+bJW78Jao4Cb2hnY66Wn1wsuA2QzHcJYiFQLqR5eg34/Jr6fHOq6I4cY6UgNTafgID Al+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=2fijQ7TKMIt7SfOlxpBNp924p9/bMB3BjK7YiFJWydk=; b=U7sHgp01OzkzlEN0UPk+lS4Vb0ax+pNNy/GOcqh508V3VmfPf39juNq0ef3d0Fr2qu Uiq7J+FiPf1ctTXW3fYzQlU8uCZ4I/WkVlziyORRFCMasX8EQ6yaCR/+vOBXsamXfCya z3vfs/9W3AwVodyZJqqQYRU5yLIJjiOAkY6cGYKqMsQAPxzzAIrRK84nauso1+JkFmfS gsJ457UPx+WQ8U2s3WPlGlQmlCyYzuIKdT5q40TH/2TMtsq7LYPHBPuXrWpoo68N9xrE ds0JaRV08/c99WCYekJBvxSSJpR/V5+vxE5/Y0Io+mFMvs4FwbQRcAjZNgPBrrsx23bE V7Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K5AGusU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t3si8936853iov.10.2021.05.14.19.08.03; Fri, 14 May 2021 19:08:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=K5AGusU4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231825AbhENQU5 (ORCPT + 99 others); Fri, 14 May 2021 12:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbhENQU4 (ORCPT ); Fri, 14 May 2021 12:20:56 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBCC6C061574; Fri, 14 May 2021 09:19:44 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id lg14so3518456ejb.9; Fri, 14 May 2021 09:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=2fijQ7TKMIt7SfOlxpBNp924p9/bMB3BjK7YiFJWydk=; b=K5AGusU4Cph9q2+XN73VdvwMe/zmv80CTSzNFULZtkYS7qXl7u+Np3wYLzOEYj+V5N iT66kBWC7KI+TN3FGCOw/vuXGdAMaknKH24CfgmVj8G+WhEVq7pPhlhDocTnbZFPncVM FM4QA7Kvj2CQ9sleFQMP5g3a2G8YmIAzTayMYMPmUiX7NuCTiQJu/p81xU85jPjYM/JZ aP5A5hIAg8vO8flu8d4+k38+LryRjtrFvl4oYuAWZyE7SQDesyVEyBOxvbo28NipQUKo P6gMiw+SQFZN2TGKk2EygP2hGs4QL2DS76nCBGQDRYSPXVimneWgrmcwPyZkpcRve+zs sXmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=2fijQ7TKMIt7SfOlxpBNp924p9/bMB3BjK7YiFJWydk=; b=O97rMLOxWdP7IDIfq8NTM+u/cPs45pjjTVD+fhZ++VYqPWj2QsRDQflvdbfSCm2YQy Y5BltsdrRUdb5tnm6aM7ZTVgL/ntZplqSdzJLD9DF496LphzNGCTOz5Fx0hLgyfA7ZNS YIjntas3L3niCyOoymlcG/1g4awK8lQujWgEmDRQwIXet+SBa83/UJ0RUlhOhCs3DkU5 iwXppcDOk6y8r5kz/Afu7jHmfAv3s9LI5O8wjGA94ItWyv8L67sBpW3aHihkssXbPicp 1ra0G/eM4ZlgY2rq3zjy8pvjO6wGf3GuvHPr1Oo2aVtgodWZwkcvQ9FoYhiU0D3R1lWz C42Q== X-Gm-Message-State: AOAM533UKyZ/AQOVJC+A6YJpGAQz2rW3ucKtBXOSphBy7n1KYpKLxuoW kZ+rK6d7MEmVt8tpQ8fqKUVM1gUwE4A= X-Received: by 2002:a17:906:a1c7:: with SMTP id bx7mr11571928ejb.401.1621009183679; Fri, 14 May 2021 09:19:43 -0700 (PDT) Received: from gmail.com (0526E777.dsl.pool.telekom.hu. [5.38.231.119]) by smtp.gmail.com with ESMTPSA id g17sm6081759edv.47.2021.05.14.09.19.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 09:19:43 -0700 (PDT) Sender: Ingo Molnar Date: Fri, 14 May 2021 18:19:41 +0200 From: Ingo Molnar To: David Laight Cc: 'Thomas Gleixner' , 'Maximilian Luz' , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Sachi King , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: Re: [PATCH] x86/i8259: Work around buggy legacy PIC Message-ID: References: <20210512210459.1983026-1-luzmaximilian@gmail.com> <9b70d8113c084848b8d9293c4428d71b@AcuMS.aculab.com> <87tun54gg3.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * David Laight wrote: > > > It is also worth noting that the probe code is spectacularly crap. > > > It writes 0xff and then checks that 0xff is read back. > > > Almost anything (including a failed PCIe read to the ISA bridge) > > > will return 0xff and make the test pass. > > > > unsigned char probe_val = ~(1 << PIC_CASCADE_IR); > > > > outb(probe_val, PIC_MASTER_IMR); > > new_val = inb(PIC_MASTER_IMR); > > > > How is that writing 0xFF? > > Sorry I misread the code and diagnostic output. > > In any case writing a value and expecting the same value back > isn't exactly a high-quality probe. It's not, and it's not intended to be: 0x21 is a well-known port nobody was crazy enough to override yet, so that probe basically filters out the "there is nothing at that port, at all" case, which would normally return 0xff, or in a few weird cases 0x00 perhaps. Writing something inbetween those values and getting the same value back tells us that something functional occupies that well-known IO-port, pretending to be a i8259 PIC. Which is what we wanted to know, given the context. Thanks, Ingo