Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4349693imw; Tue, 12 Jul 2022 06:33:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tMnuojbHdS4wwsWSr85TVDYqbGlMGQH20uxfwfyswp9X9bEcjyRDxSafTxr8hadf1T3G4Y X-Received: by 2002:a17:906:84f0:b0:72b:72b6:c7b2 with SMTP id zp16-20020a17090684f000b0072b72b6c7b2mr5653066ejb.642.1657632792757; Tue, 12 Jul 2022 06:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657632792; cv=none; d=google.com; s=arc-20160816; b=wy+Y/ztLSfNoZVq+oiUQklE2mjoAKuGyBPW/3N7SxFauBmz3P9UVC6lKQHrefLLeXh ZP60yOa/+myyq73PhimSa8bk1a0BDPU3LltrY4HZToXgmnV2ztJbzYg2iloolnNgPK8A 7vK6TYXfecYqokC0iDc0W+L37iYJHy61P/gyWc4tjWlg2TD15iAs6siJQL+WJ6x7JYVK qASnxOTOOAXYkh8QFhL4HmJOtv/FUQ6NP4DyJmWydni2IP6BqDFd+mJd4VfxlK701CMA YkdNw3U2NDbEZdUyqDNnJmjjUQdWIMxSSb+TWPQmkOuzk/Y0jKgisFn4GfhJd1/m0a+J asSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tPT19Kfs8LeMRuQNUNS/QgGrqQ3NwvwMCFw4PNMdSIs=; b=Xy+nwL7uyncATgIwalpngPa3PMhde+7vS/YuX1FarV88CAw3jtLr+a9oDK43z5fDxB XYDZbd0XmLaOlG30X39sbcScPsSh9a4da+ZyElNq+ZlxW/rsOGmWodM028xD+1X4AOr3 7Nvc2yXZ9JgfBeUb7EKDb0Ck2p3muVeT5vJ+yDyNF60cfwf8+2p3qoZwifHutzz4agw/ ZiCfgE8QzbjFNdA+BLyhRHX7JninAwVQEElXat+mOPg4xcplrUpQKu2gMNFnb/eJfj1l pvfe4YfIloweJfnr4PgmcMZovg97ukC6vKln3ouZd2hnPtMFzRqN9fQgekNobE+8LiJp xrng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X8Px23L+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qh4-20020a170906eca400b0072ab62ae019si12468698ejb.859.2022.07.12.06.32.48; Tue, 12 Jul 2022 06:33:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=X8Px23L+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231314AbiGLN0h (ORCPT + 99 others); Tue, 12 Jul 2022 09:26:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbiGLN0g (ORCPT ); Tue, 12 Jul 2022 09:26:36 -0400 Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C354388F34; Tue, 12 Jul 2022 06:26:35 -0700 (PDT) Received: by mail-yb1-xb2a.google.com with SMTP id l11so13855410ybu.13; Tue, 12 Jul 2022 06:26:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tPT19Kfs8LeMRuQNUNS/QgGrqQ3NwvwMCFw4PNMdSIs=; b=X8Px23L+V3za0BnD3cakHrQ4J6Ya3vYywEENBbezm987pke851PTKV3avyjDFjRkw7 ZsMydqcBLJv1w8HwUidrwp60ZfwEAubhw+4j8iw97cXOtLbJKICSf6edAkIhIVxrVO8o 8djHIoBs1X07CJJYqcfCtAaUFJOpJSP5MRkA6zs3DqGDRHrldH/RErwdGp23qryQlRIC YFIuOdj4zngBXTJUgkZUvsODCNIVAFLxd1LCmFfFpbQHujNoDKsY9Ic5Oa/8tqjIhNmQ r5zdPSWjKg0hnVDxffWc1k8rwNa6q5NtVYRXJ9mF76y0MxTeb43IL3FXKFltVity347i QukA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tPT19Kfs8LeMRuQNUNS/QgGrqQ3NwvwMCFw4PNMdSIs=; b=fi/WLCIfkY86Q5dZdxjf4GtoX0+JU8Qi1TCrVkVoWQJM+SB+jz4MAVvDlw+SPrl6UE JyGH3D2stV6Xfy51ADkyoK1Mt3uB63ZqxLJ7cDuriixnFpAkEe8Au+YPpuMnH14uyfwC LBXXGAQ2VZB2cBf2yfaShHTBhIpwikWBHwFaBoht4fIx4v7TRqf1grrnm0thOXGuqoS9 o2NPN0KlVAY57RKnMQK5fqW1zwdZmDu0zZStwIg8enLPMfDEPtvBlKL+mfMizrz2+aHy kKdR5/GfcEyhwaNWdc2BtcxabZULZwK8FkpgNkAjFl40sT9l7LY2tch78FYLAP8163jU btVQ== X-Gm-Message-State: AJIora+MYg3cHC8d1tws4msHb4Z97Y0JnXAFlNkkUS8o2MIBUMCkAZt3 +sCivBVls0gJIh5c+wLN6m8gNDWzZAG1uHNYcnA= X-Received: by 2002:a25:cbcf:0:b0:66e:8893:a02c with SMTP id b198-20020a25cbcf000000b0066e8893a02cmr23004457ybg.460.1657632394963; Tue, 12 Jul 2022 06:26:34 -0700 (PDT) MIME-Version: 1.0 References: <20220712131523.1874428-1-vamshigajjela@google.com> In-Reply-To: <20220712131523.1874428-1-vamshigajjela@google.com> From: Andy Shevchenko Date: Tue, 12 Jul 2022 15:25:57 +0200 Message-ID: Subject: Re: [PATCH] serial: 8250_dw: Avoid pslverr on reading empty receiver fifo To: Vamshi Gajjela Cc: Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby , Miquel Raynal , Phil Edworthy , Emil Renner Berthing , Heikki Krogerus , Johan Hovold , "open list:SERIAL DRIVERS" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 12, 2022 at 3:16 PM Vamshi Gajjela wrote: > > From: VAMSHI GAJJELA > > With PSLVERR_RESP_EN parameter set to 1, device generates an error the device > response when an attempt to read empty RBR with FIFO enabled. an empty > This happens when LCR writes are ignored when UART is busy. > dw8250_check_lcr() in retries to updateLCR, invokes dw8250_force_idle() > to clear and reset fifo and eventually reads UART_RX causing pslverr. fifo --> FIFO pslverr --> the error > Avoid this by not reading RBR/UART_RX when no data is available. ... > + unsigned int lsr; > struct uart_8250_port *up = up_to_u8250p(p); Can we keep it ordered according to the reversed xmas tree? ... > + /* > + * With PSLVERR_RESP_EN parameter set to 1, device generates pslverr the device pslverr --> an > + * error response when an attempt to read empty RBR with FIFO enabled Missed period. > + */ > + lsr = p->serial_in(p, UART_LSR); The only caller of this function already has the lsr value, why you can't (re)use it? > + if ((up->fcr & UART_FCR_ENABLE_FIFO) && !(lsr & UART_LSR_DR)) > + return; -- With Best Regards, Andy Shevchenko