Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1568429 > unrolled thread

[PATCH] i2c: piix4: Fix request_region size

Started byRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
First post2017-01-27 16:20 +0100
Last post2017-01-30 02:20 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] i2c: piix4: Fix request_region size Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2017-01-27 16:20 +0100
    Re: [PATCH] i2c: piix4: Fix request_region size Jean Delvare <jdelvare@suse.de> - 2017-01-28 09:40 +0100
      Re: [PATCH] i2c: piix4: Fix request_region size Wolfram Sang <wsa@the-dreams.de> - 2017-01-28 12:10 +0100
        Re: [PATCH] i2c: piix4: Fix request_region size Jean Delvare <jdelvare@suse.de> - 2017-01-28 12:20 +0100
          Re: [PATCH] i2c: piix4: Fix request_region size Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> - 2017-01-30 02:20 +0100

#1568429 — [PATCH] i2c: piix4: Fix request_region size

FromRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date2017-01-27 16:20 +0100
Subject[PATCH] i2c: piix4: Fix request_region size
Message-ID<t4gtI-5Mm-23@gated-at.bofh.it>
Since '701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")' we
are using the SMBSLVCNT register at offset 0x8. We need to request it.

Fixes: 701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
---
Please note, not tested on hardware.
 drivers/i2c/busses/i2c-piix4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index e34d82e79b98..73cc6799cc59 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -58,7 +58,7 @@
 #define SMBSLVDAT	(0xC + piix4_smba)
 
 /* count for request_region */
-#define SMBIOSIZE	8
+#define SMBIOSIZE	9
 
 /* PCI Address Constants */
 #define SMBBA		0x090
-- 
2.11.0

[toc] | [next] | [standalone]


#1568848

FromJean Delvare <jdelvare@suse.de>
Date2017-01-28 09:40 +0100
Message-ID<t4wI9-7pN-5@gated-at.bofh.it>
In reply to#1568429
Hi Ricardo,

On ven., 2017-01-27 at 15:59 +0100, Ricardo Ribalda Delgado wrote:
> Since '701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")'
> we
> are using the SMBSLVCNT register at offset 0x8. We need to request
> it.
> 
> Fixes: 701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
> Please note, not tested on hardware.
>  drivers/i2c/busses/i2c-piix4.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-
> piix4.c
> index e34d82e79b98..73cc6799cc59 100644
> --- a/drivers/i2c/busses/i2c-piix4.c
> +++ b/drivers/i2c/busses/i2c-piix4.c
> @@ -58,7 +58,7 @@
>  #define SMBSLVDAT	(0xC + piix4_smba)
>  
>  /* count for request_region */
> -#define SMBIOSIZE	8
> +#define SMBIOSIZE	9
> 

Are you certain that all supported devices have this extra register?

>  
>  /* PCI Address Constants */
>  #define SMBBA		0x090

-- 
Jean Delvare
SUSE L3 Support

[toc] | [prev] | [next] | [standalone]


#1568867

FromWolfram Sang <wsa@the-dreams.de>
Date2017-01-28 12:10 +0100
Message-ID<t4z3j-CN-5@gated-at.bofh.it>
In reply to#1568848

[Multipart message — attachments visible in raw view] — view raw

> >  /* count for request_region */
> > -#define SMBIOSIZE	8
> > +#define SMBIOSIZE	9
> > 
> 
> Are you certain that all supported devices have this extra register?

Isn't it better to have a potentially unused register mapped than a
potentially used register unmapped?

[toc] | [prev] | [next] | [standalone]


#1568868

FromJean Delvare <jdelvare@suse.de>
Date2017-01-28 12:20 +0100
Message-ID<t4zcZ-Gf-5@gated-at.bofh.it>
In reply to#1568867
Hi Wolfram,

On Sat, 28 Jan 2017 12:00:21 +0100, Wolfram Sang wrote:
> 
> > >  /* count for request_region */
> > > -#define SMBIOSIZE	8
> > > +#define SMBIOSIZE	9
> > 
> > Are you certain that all supported devices have this extra register?
> 
> Isn't it better to have a potentially unused register mapped than a
> potentially used register unmapped?

My concern is that the region request could fail due to a conflict with
another device, if the physical I/O region is only 8 and we try to
request 9.

-- 
Jean Delvare
SUSE L3 Support

[toc] | [prev] | [next] | [standalone]


#1569333

FromRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Date2017-01-30 02:20 +0100
Message-ID<t58Ns-64o-11@gated-at.bofh.it>
In reply to#1568868
Hi Jean and Wolfram



On Sat, Jan 28, 2017 at 12:13 PM, Jean Delvare <jdelvare@suse.de> wrote:
> Hi Wolfram,
>
> On Sat, 28 Jan 2017 12:00:21 +0100, Wolfram Sang wrote:
>>
>> > >  /* count for request_region */
>> > > -#define SMBIOSIZE        8
>> > > +#define SMBIOSIZE        9
>> >
>> > Are you certain that all supported devices have this extra register?
>>
>> Isn't it better to have a potentially unused register mapped than a
>> potentially used register unmapped

We have been  "lucky" that it is a ioport and not a mmap region,
otherwise we would have seen a nice oops :).

>
> My concern is that the region request could fail due to a conflict with
> another device, if the physical I/O region is only 8 and we try to
> request 9.

I do not think that this is the case, if you check the top of the file
you can see how there are many other definitions for registers. I
expect that SMBIOSIZE=8 is just the original author being
conservative.

Of course I cannot say that there is one platform where one extra
ioport can cause a conflict, but I believe that we must request all
the ports that we will use.


Regards!
>
> --
> Jean Delvare
> SUSE L3 Support



-- 
Ricardo Ribalda

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web