diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-08-03 23:10:57 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-08-05 18:34:50 -0400 |
commit | 0bf9b0e0ce9140c200c0db67a0c71983f07e1a65 (patch) | |
tree | 8663e8157d4b19a6d60e0d526dd797042c02b38e | |
parent | a0d069ea2c7b81a453d258c7f60e1f61a3fcbd9f (diff) |
drm/nouveau: Don't pass misaligned offsets to io_mapping_map_atomic_wc().
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 7369b5e73649..66035283546a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -2083,9 +2083,10 @@ peek_fb(struct drm_device *dev, struct io_mapping *fb, | |||
2083 | uint32_t val = 0; | 2083 | uint32_t val = 0; |
2084 | 2084 | ||
2085 | if (off < pci_resource_len(dev->pdev, 1)) { | 2085 | if (off < pci_resource_len(dev->pdev, 1)) { |
2086 | uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off, KM_USER0); | 2086 | uint32_t __iomem *p = |
2087 | io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0); | ||
2087 | 2088 | ||
2088 | val = ioread32(p); | 2089 | val = ioread32(p + (off & ~PAGE_MASK)); |
2089 | 2090 | ||
2090 | io_mapping_unmap_atomic(p, KM_USER0); | 2091 | io_mapping_unmap_atomic(p, KM_USER0); |
2091 | } | 2092 | } |
@@ -2098,9 +2099,10 @@ poke_fb(struct drm_device *dev, struct io_mapping *fb, | |||
2098 | uint32_t off, uint32_t val) | 2099 | uint32_t off, uint32_t val) |
2099 | { | 2100 | { |
2100 | if (off < pci_resource_len(dev->pdev, 1)) { | 2101 | if (off < pci_resource_len(dev->pdev, 1)) { |
2101 | uint32_t __iomem *p = io_mapping_map_atomic_wc(fb, off, KM_USER0); | 2102 | uint32_t __iomem *p = |
2103 | io_mapping_map_atomic_wc(fb, off & PAGE_MASK, KM_USER0); | ||
2102 | 2104 | ||
2103 | iowrite32(val, p); | 2105 | iowrite32(val, p + (off & ~PAGE_MASK)); |
2104 | wmb(); | 2106 | wmb(); |
2105 | 2107 | ||
2106 | io_mapping_unmap_atomic(p, KM_USER0); | 2108 | io_mapping_unmap_atomic(p, KM_USER0); |