Merge tag 'drm-intel-fixes-2023-02-09' of git://anongit.freedesktop.org/drm/drm-intel...
authorDave Airlie <airlied@redhat.com>
Thu, 9 Feb 2023 23:47:20 +0000 (09:47 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 9 Feb 2023 23:48:01 +0000 (09:48 +1000)
- Display watermark fix (Ville)
- fbdev fix for PSR, FBC, DRRS (Jouni)
- Move fd_install after last use of fence (Rob)
- Initialize the obj flags for shmem objects (Aravind)
- Fix VBT DSI DVO port handling (Ville)

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/Y+UZ0rh2YlhTrE4t@intel.com
19 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/soc21.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c
drivers/gpu/drm/amd/pm/amdgpu_pm.c
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h
drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
drivers/gpu/drm/drm_client.c
drivers/gpu/drm/virtio/virtgpu_ioctl.c
drivers/video/fbdev/nvidia/nvidia.c
include/drm/drm_client.h
include/uapi/drm/virtgpu_drm.h

index 7b5ce00..7af3041 100644 (file)
@@ -1220,10 +1220,13 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)
                 * next job actually sees the results from the previous one
                 * before we start executing on the same scheduler ring.
                 */
-               if (!s_fence || s_fence->sched != sched)
+               if (!s_fence || s_fence->sched != sched) {
+                       dma_fence_put(fence);
                        continue;
+               }
 
                r = amdgpu_sync_fence(&p->gang_leader->explicit_sync, fence);
+               dma_fence_put(fence);
                if (r)
                        return r;
        }
index 0044420..faff4a3 100644 (file)
@@ -618,7 +618,13 @@ void amdgpu_fence_driver_sw_fini(struct amdgpu_device *adev)
                if (!ring || !ring->fence_drv.initialized)
                        continue;
 
-               if (!ring->no_scheduler)
+               /*
+                * Notice we check for sched.ops since there's some
+                * override on the meaning of sched.ready by amdgpu.
+                * The natural check would be sched.ready, which is
+                * set as drm_sched_init() finishes...
+                */
+               if (ring->sched.ops)
                        drm_sched_fini(&ring->sched);
 
                for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j)
index f752c7a..3989e75 100644 (file)
@@ -295,7 +295,7 @@ struct amdgpu_ring {
 #define amdgpu_ring_parse_cs(r, p, job, ib) ((r)->funcs->parse_cs((p), (job), (ib)))
 #define amdgpu_ring_patch_cs_in_place(r, p, job, ib) ((r)->funcs->patch_cs_in_place((p), (job), (ib)))
 #define amdgpu_ring_test_ring(r) (r)->funcs->test_ring((r))
-#define amdgpu_ring_test_ib(r, t) (r)->funcs->test_ib((r), (t))
+#define amdgpu_ring_test_ib(r, t) ((r)->funcs->test_ib ? (r)->funcs->test_ib((r), (t)) : 0)
 #define amdgpu_ring_get_rptr(r) (r)->funcs->get_rptr((r))
 #define amdgpu_ring_get_wptr(r) (r)->funcs->get_wptr((r))
 #define amdgpu_ring_set_wptr(r) (r)->funcs->set_wptr((r))
index b5f3bba..01e42bd 100644 (file)
@@ -974,7 +974,7 @@ int amdgpu_vm_ptes_update(struct amdgpu_vm_update_params *params,
                        trace_amdgpu_vm_update_ptes(params, frag_start, upd_end,
                                                    min(nptes, 32u), dst, incr,
                                                    upd_flags,
-                                                   vm->task_info.pid,
+                                                   vm->task_info.tgid,
                                                    vm->immediate.fence_context);
                        amdgpu_vm_pte_update_flags(params, to_amdgpu_bo_vm(pt),
                                                   cursor.level, pe_start, dst,
index f202b45..5dde6f8 100644 (file)
@@ -6877,7 +6877,6 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
        .emit_gds_switch = gfx_v9_0_ring_emit_gds_switch,
        .emit_hdp_flush = gfx_v9_0_ring_emit_hdp_flush,
        .test_ring = gfx_v9_0_ring_test_ring,
-       .test_ib = gfx_v9_0_ring_test_ib,
        .insert_nop = amdgpu_ring_insert_nop,
        .pad_ib = amdgpu_ring_generic_pad_ib,
        .emit_switch_buffer = gfx_v9_ring_emit_sb,
index 9eff5f4..7050238 100644 (file)
@@ -641,7 +641,9 @@ static int soc21_common_early_init(void *handle)
                        AMD_CG_SUPPORT_GFX_CGLS |
                        AMD_CG_SUPPORT_REPEATER_FGCG |
                        AMD_CG_SUPPORT_GFX_MGCG |
-                       AMD_CG_SUPPORT_HDP_SD;
+                       AMD_CG_SUPPORT_HDP_SD |
+                       AMD_CG_SUPPORT_ATHUB_MGCG |
+                       AMD_CG_SUPPORT_ATHUB_LS;
                adev->pg_flags = AMD_PG_SUPPORT_VCN |
                        AMD_PG_SUPPORT_VCN_DPG |
                        AMD_PG_SUPPORT_JPEG;
index 31bce52..7845285 100644 (file)
@@ -1184,24 +1184,38 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_
 
        memset(pa_config, 0, sizeof(*pa_config));
 
-       logical_addr_low  = min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18;
-       pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
-
-       if (adev->apu_flags & AMD_APU_IS_RAVEN2)
-               /*
-                * Raven2 has a HW issue that it is unable to use the vram which
-                * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
-                * workaround that increase system aperture high address (add 1)
-                * to get rid of the VM fault and hardware hang.
-                */
-               logical_addr_high = max((adev->gmc.fb_end >> 18) + 0x1, adev->gmc.agp_end >> 18);
-       else
-               logical_addr_high = max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18;
-
        agp_base = 0;
        agp_bot = adev->gmc.agp_start >> 24;
        agp_top = adev->gmc.agp_end >> 24;
 
+       /* AGP aperture is disabled */
+       if (agp_bot == agp_top) {
+               logical_addr_low  = adev->gmc.vram_start >> 18;
+               if (adev->apu_flags & AMD_APU_IS_RAVEN2)
+                       /*
+                        * Raven2 has a HW issue that it is unable to use the vram which
+                        * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
+                        * workaround that increase system aperture high address (add 1)
+                        * to get rid of the VM fault and hardware hang.
+                        */
+                       logical_addr_high = (adev->gmc.fb_end >> 18) + 0x1;
+               else
+                       logical_addr_high = adev->gmc.vram_end >> 18;
+       } else {
+               logical_addr_low  = min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18;
+               if (adev->apu_flags & AMD_APU_IS_RAVEN2)
+                       /*
+                        * Raven2 has a HW issue that it is unable to use the vram which
+                        * is out of MC_VM_SYSTEM_APERTURE_HIGH_ADDR. So here is the
+                        * workaround that increase system aperture high address (add 1)
+                        * to get rid of the VM fault and hardware hang.
+                        */
+                       logical_addr_high = max((adev->gmc.fb_end >> 18) + 0x1, adev->gmc.agp_end >> 18);
+               else
+                       logical_addr_high = max(adev->gmc.fb_end, adev->gmc.agp_end) >> 18;
+       }
+
+       pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
 
        page_table_start.high_part = (u32)(adev->gmc.gart_start >> 44) & 0xF;
        page_table_start.low_part = (u32)(adev->gmc.gart_start >> 12);
@@ -1499,10 +1513,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
                            (adev->apu_flags & AMD_APU_IS_PICASSO))
                                init_data.flags.gpu_vm_support = true;
                        break;
-               case IP_VERSION(2, 1, 0):
                case IP_VERSION(3, 0, 1):
-               case IP_VERSION(3, 1, 2):
-               case IP_VERSION(3, 1, 3):
+               case IP_VERSION(3, 1, 4):
                case IP_VERSION(3, 1, 6):
                        init_data.flags.gpu_vm_support = true;
                        break;
index fe2023f..8f894c1 100644 (file)
@@ -3626,7 +3626,7 @@ void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx)
                                                (int)hubp->curs_attr.width || pos_cpy.x
                                                <= (int)hubp->curs_attr.width +
                                                pipe_ctx->plane_state->src_rect.x) {
-                                               pos_cpy.x = temp_x + viewport_width;
+                                               pos_cpy.x = 2 * viewport_width - temp_x;
                                        }
                                }
                        } else {
index a917036..2f3e239 100644 (file)
@@ -1991,6 +1991,8 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
                case IP_VERSION(9, 4, 2):
                case IP_VERSION(10, 3, 0):
                case IP_VERSION(11, 0, 0):
+               case IP_VERSION(11, 0, 1):
+               case IP_VERSION(11, 0, 2):
                        *states = ATTR_STATE_SUPPORTED;
                        break;
                default:
index d6b964c..4bc7aee 100644 (file)
                                                                        (1 << FEATURE_DS_FCLK_BIT) | \
                                                                        (1 << FEATURE_DS_LCLK_BIT) | \
                                                                        (1 << FEATURE_DS_DCFCLK_BIT) | \
-                                                                       (1 << FEATURE_DS_UCLK_BIT))
+                                                                       (1 << FEATURE_DS_UCLK_BIT) | \
+                                                                       (1ULL << FEATURE_DS_VCN_BIT))
 
 //For use with feature control messages
 typedef enum {
@@ -522,9 +523,9 @@ typedef enum  {
   TEMP_HOTSPOT_M,
   TEMP_MEM,
   TEMP_VR_GFX,
-  TEMP_VR_SOC,
   TEMP_VR_MEM0,
   TEMP_VR_MEM1,
+  TEMP_VR_SOC,
   TEMP_VR_U,
   TEMP_LIQUID0,
   TEMP_LIQUID1,
index d6b1393..48a3a39 100644 (file)
 #define NUM_FEATURES                          64
 
 #define ALLOWED_FEATURE_CTRL_DEFAULT 0xFFFFFFFFFFFFFFFFULL
-#define ALLOWED_FEATURE_CTRL_SCPM        (1 << FEATURE_DPM_GFXCLK_BIT) | \
-                                         (1 << FEATURE_DPM_GFX_POWER_OPTIMIZER_BIT) | \
-                                         (1 << FEATURE_DPM_UCLK_BIT) | \
-                                         (1 << FEATURE_DPM_FCLK_BIT) | \
-                                         (1 << FEATURE_DPM_SOCCLK_BIT) | \
-                                         (1 << FEATURE_DPM_MP0CLK_BIT) | \
-                                         (1 << FEATURE_DPM_LINK_BIT) | \
-                                         (1 << FEATURE_DPM_DCN_BIT) | \
-                                         (1 << FEATURE_DS_GFXCLK_BIT) | \
-                                         (1 << FEATURE_DS_SOCCLK_BIT) | \
-                                         (1 << FEATURE_DS_FCLK_BIT) | \
-                                         (1 << FEATURE_DS_LCLK_BIT) | \
-                                         (1 << FEATURE_DS_DCFCLK_BIT) | \
-                                         (1 << FEATURE_DS_UCLK_BIT)
+#define ALLOWED_FEATURE_CTRL_SCPM      ((1 << FEATURE_DPM_GFXCLK_BIT) | \
+                                       (1 << FEATURE_DPM_GFX_POWER_OPTIMIZER_BIT) | \
+                                       (1 << FEATURE_DPM_UCLK_BIT) | \
+                                       (1 << FEATURE_DPM_FCLK_BIT) | \
+                                       (1 << FEATURE_DPM_SOCCLK_BIT) | \
+                                       (1 << FEATURE_DPM_MP0CLK_BIT) | \
+                                       (1 << FEATURE_DPM_LINK_BIT) | \
+                                       (1 << FEATURE_DPM_DCN_BIT) | \
+                                       (1 << FEATURE_DS_GFXCLK_BIT) | \
+                                       (1 << FEATURE_DS_SOCCLK_BIT) | \
+                                       (1 << FEATURE_DS_FCLK_BIT) | \
+                                       (1 << FEATURE_DS_LCLK_BIT) | \
+                                       (1 << FEATURE_DS_DCFCLK_BIT) | \
+                                       (1 << FEATURE_DS_UCLK_BIT) | \
+                                       (1ULL << FEATURE_DS_VCN_BIT))
 
 //For use with feature control messages
 typedef enum {
index e8c6feb..992163e 100644 (file)
 #define SMU13_DRIVER_IF_VERSION_INV 0xFFFFFFFF
 #define SMU13_DRIVER_IF_VERSION_YELLOW_CARP 0x04
 #define SMU13_DRIVER_IF_VERSION_ALDE 0x08
-#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0_0 0x34
+#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0_0 0x37
 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_4 0x07
 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_5 0x04
 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_0_10 0x32
-#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_7 0x35
+#define SMU13_DRIVER_IF_VERSION_SMU_V13_0_7 0x37
 #define SMU13_DRIVER_IF_VERSION_SMU_V13_0_10 0x1D
 
 #define SMU13_MODE1_RESET_WAIT_TIME_IN_MS 500  //500ms
index cf96c3f..508e392 100644 (file)
@@ -407,6 +407,9 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
        struct amdgpu_device *adev = smu->adev;
        int ret = 0;
 
+       if (amdgpu_sriov_vf(smu->adev))
+               return 0;
+
        ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
                                                &smu_table->power_play_table,
                                                &smu_table->power_play_table_size);
@@ -1257,6 +1260,9 @@ static int smu_v13_0_0_get_thermal_temperature_range(struct smu_context *smu,
                table_context->power_play_table;
        PPTable_t *pptable = smu->smu_table.driver_pptable;
 
+       if (amdgpu_sriov_vf(smu->adev))
+               return 0;
+
        if (!range)
                return -EINVAL;
 
index e87db7e..9e1967d 100644 (file)
@@ -124,6 +124,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] =
        MSG_MAP(DFCstateControl,                PPSMC_MSG_SetExternalClientDfCstateAllow, 0),
        MSG_MAP(ArmD3,                          PPSMC_MSG_ArmD3,                       0),
        MSG_MAP(AllowGpo,                       PPSMC_MSG_SetGpoAllow,           0),
+       MSG_MAP(GetPptLimit,                    PPSMC_MSG_GetPptLimit,                 0),
 };
 
 static struct cmn2asic_mapping smu_v13_0_7_clk_map[SMU_CLK_COUNT] = {
index fd67efe..056ab9d 100644 (file)
@@ -233,21 +233,17 @@ void drm_client_dev_restore(struct drm_device *dev)
 
 static void drm_client_buffer_delete(struct drm_client_buffer *buffer)
 {
-       struct drm_device *dev = buffer->client->dev;
-
        if (buffer->gem) {
                drm_gem_vunmap_unlocked(buffer->gem, &buffer->map);
                drm_gem_object_put(buffer->gem);
        }
 
-       if (buffer->handle)
-               drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
-
        kfree(buffer);
 }
 
 static struct drm_client_buffer *
-drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format)
+drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height,
+                        u32 format, u32 *handle)
 {
        const struct drm_format_info *info = drm_format_info(format);
        struct drm_mode_create_dumb dumb_args = { };
@@ -269,16 +265,15 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
        if (ret)
                goto err_delete;
 
-       buffer->handle = dumb_args.handle;
-       buffer->pitch = dumb_args.pitch;
-
        obj = drm_gem_object_lookup(client->file, dumb_args.handle);
        if (!obj)  {
                ret = -ENOENT;
                goto err_delete;
        }
 
+       buffer->pitch = dumb_args.pitch;
        buffer->gem = obj;
+       *handle = dumb_args.handle;
 
        return buffer;
 
@@ -365,7 +360,8 @@ static void drm_client_buffer_rmfb(struct drm_client_buffer *buffer)
 }
 
 static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
-                                  u32 width, u32 height, u32 format)
+                                  u32 width, u32 height, u32 format,
+                                  u32 handle)
 {
        struct drm_client_dev *client = buffer->client;
        struct drm_mode_fb_cmd fb_req = { };
@@ -377,7 +373,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
        fb_req.depth = info->depth;
        fb_req.width = width;
        fb_req.height = height;
-       fb_req.handle = buffer->handle;
+       fb_req.handle = handle;
        fb_req.pitch = buffer->pitch;
 
        ret = drm_mode_addfb(client->dev, &fb_req, client->file);
@@ -414,13 +410,24 @@ struct drm_client_buffer *
 drm_client_framebuffer_create(struct drm_client_dev *client, u32 width, u32 height, u32 format)
 {
        struct drm_client_buffer *buffer;
+       u32 handle;
        int ret;
 
-       buffer = drm_client_buffer_create(client, width, height, format);
+       buffer = drm_client_buffer_create(client, width, height, format,
+                                         &handle);
        if (IS_ERR(buffer))
                return buffer;
 
-       ret = drm_client_buffer_addfb(buffer, width, height, format);
+       ret = drm_client_buffer_addfb(buffer, width, height, format, handle);
+
+       /*
+        * The handle is only needed for creating the framebuffer, destroy it
+        * again to solve a circular dependency should anybody export the GEM
+        * object as DMA-buf. The framebuffer and our buffer structure are still
+        * holding references to the GEM object to prevent its destruction.
+        */
+       drm_mode_destroy_dumb(client->dev, handle, client->file);
+
        if (ret) {
                drm_client_buffer_delete(buffer);
                return ERR_PTR(ret);
index 9f4a904..da45215 100644 (file)
@@ -126,7 +126,6 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
        void __user *user_bo_handles = NULL;
        struct virtio_gpu_object_array *buflist = NULL;
        struct sync_file *sync_file;
-       int in_fence_fd = exbuf->fence_fd;
        int out_fence_fd = -1;
        void *buf;
        uint64_t fence_ctx;
@@ -152,13 +151,11 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
                ring_idx = exbuf->ring_idx;
        }
 
-       exbuf->fence_fd = -1;
-
        virtio_gpu_create_context(dev, file);
        if (exbuf->flags & VIRTGPU_EXECBUF_FENCE_FD_IN) {
                struct dma_fence *in_fence;
 
-               in_fence = sync_file_get_fence(in_fence_fd);
+               in_fence = sync_file_get_fence(exbuf->fence_fd);
 
                if (!in_fence)
                        return -EINVAL;
index 1960916..e60a276 100644 (file)
@@ -1197,17 +1197,17 @@ static int nvidia_set_fbinfo(struct fb_info *info)
        return nvidiafb_check_var(&info->var, info);
 }
 
-static u32 nvidia_get_chipset(struct fb_info *info)
+static u32 nvidia_get_chipset(struct pci_dev *pci_dev,
+                             volatile u32 __iomem *REGS)
 {
-       struct nvidia_par *par = info->par;
-       u32 id = (par->pci_dev->vendor << 16) | par->pci_dev->device;
+       u32 id = (pci_dev->vendor << 16) | pci_dev->device;
 
        printk(KERN_INFO PFX "Device ID: %x \n", id);
 
        if ((id & 0xfff0) == 0x00f0 ||
            (id & 0xfff0) == 0x02e0) {
                /* pci-e */
-               id = NV_RD32(par->REGS, 0x1800);
+               id = NV_RD32(REGS, 0x1800);
 
                if ((id & 0x0000ffff) == 0x000010DE)
                        id = 0x10DE0000 | (id >> 16);
@@ -1220,12 +1220,11 @@ static u32 nvidia_get_chipset(struct fb_info *info)
        return id;
 }
 
-static u32 nvidia_get_arch(struct fb_info *info)
+static u32 nvidia_get_arch(u32 Chipset)
 {
-       struct nvidia_par *par = info->par;
        u32 arch = 0;
 
-       switch (par->Chipset & 0x0ff0) {
+       switch (Chipset & 0x0ff0) {
        case 0x0100:            /* GeForce 256 */
        case 0x0110:            /* GeForce2 MX */
        case 0x0150:            /* GeForce2 */
@@ -1278,16 +1277,44 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)
        struct fb_info *info;
        unsigned short cmd;
        int ret;
+       volatile u32 __iomem *REGS;
+       int Chipset;
+       u32 Architecture;
 
        NVTRACE_ENTER();
        assert(pd != NULL);
 
+       if (pci_enable_device(pd)) {
+               printk(KERN_ERR PFX "cannot enable PCI device\n");
+               return -ENODEV;
+       }
+
+       /* enable IO and mem if not already done */
+       pci_read_config_word(pd, PCI_COMMAND, &cmd);
+       cmd |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
+       pci_write_config_word(pd, PCI_COMMAND, cmd);
+
+       nvidiafb_fix.mmio_start = pci_resource_start(pd, 0);
+       nvidiafb_fix.mmio_len = pci_resource_len(pd, 0);
+
+       REGS = ioremap(nvidiafb_fix.mmio_start, nvidiafb_fix.mmio_len);
+       if (!REGS) {
+               printk(KERN_ERR PFX "cannot ioremap MMIO base\n");
+               return -ENODEV;
+       }
+
+       Chipset = nvidia_get_chipset(pd, REGS);
+       Architecture = nvidia_get_arch(Chipset);
+       if (Architecture == 0) {
+               printk(KERN_ERR PFX "unknown NV_ARCH\n");
+               goto err_out;
+       }
+
        ret = aperture_remove_conflicting_pci_devices(pd, "nvidiafb");
        if (ret)
-               return ret;
+               goto err_out;
 
        info = framebuffer_alloc(sizeof(struct nvidia_par), &pd->dev);
-
        if (!info)
                goto err_out;
 
@@ -1298,11 +1325,6 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)
        if (info->pixmap.addr == NULL)
                goto err_out_kfree;
 
-       if (pci_enable_device(pd)) {
-               printk(KERN_ERR PFX "cannot enable PCI device\n");
-               goto err_out_enable;
-       }
-
        if (pci_request_regions(pd, "nvidiafb")) {
                printk(KERN_ERR PFX "cannot request PCI regions\n");
                goto err_out_enable;
@@ -1318,34 +1340,17 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)
        par->paneltweak = paneltweak;
        par->reverse_i2c = reverse_i2c;
 
-       /* enable IO and mem if not already done */
-       pci_read_config_word(pd, PCI_COMMAND, &cmd);
-       cmd |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
-       pci_write_config_word(pd, PCI_COMMAND, cmd);
-
-       nvidiafb_fix.mmio_start = pci_resource_start(pd, 0);
        nvidiafb_fix.smem_start = pci_resource_start(pd, 1);
-       nvidiafb_fix.mmio_len = pci_resource_len(pd, 0);
-
-       par->REGS = ioremap(nvidiafb_fix.mmio_start, nvidiafb_fix.mmio_len);
 
-       if (!par->REGS) {
-               printk(KERN_ERR PFX "cannot ioremap MMIO base\n");
-               goto err_out_free_base0;
-       }
+       par->REGS = REGS;
 
-       par->Chipset = nvidia_get_chipset(info);
-       par->Architecture = nvidia_get_arch(info);
-
-       if (par->Architecture == 0) {
-               printk(KERN_ERR PFX "unknown NV_ARCH\n");
-               goto err_out_arch;
-       }
+       par->Chipset = Chipset;
+       par->Architecture = Architecture;
 
        sprintf(nvidiafb_fix.id, "NV%x", (pd->device & 0x0ff0) >> 4);
 
        if (NVCommonSetup(info))
-               goto err_out_arch;
+               goto err_out_free_base0;
 
        par->FbAddress = nvidiafb_fix.smem_start;
        par->FbMapSize = par->RamAmountKBytes * 1024;
@@ -1401,7 +1406,6 @@ static int nvidiafb_probe(struct pci_dev *pd, const struct pci_device_id *ent)
                goto err_out_iounmap_fb;
        }
 
-
        printk(KERN_INFO PFX
               "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n",
               info->fix.id,
@@ -1415,15 +1419,14 @@ err_out_iounmap_fb:
 err_out_free_base1:
        fb_destroy_modedb(info->monspecs.modedb);
        nvidia_delete_i2c_busses(par);
-err_out_arch:
-       iounmap(par->REGS);
- err_out_free_base0:
+err_out_free_base0:
        pci_release_regions(pd);
 err_out_enable:
        kfree(info->pixmap.addr);
 err_out_kfree:
        framebuffer_release(info);
 err_out:
+       iounmap(REGS);
        return -ENODEV;
 }
 
index 4fc8018..1220d18 100644 (file)
@@ -127,11 +127,6 @@ struct drm_client_buffer {
        struct drm_client_dev *client;
 
        /**
-        * @handle: Buffer handle
-        */
-       u32 handle;
-
-       /**
         * @pitch: Buffer pitch
         */
        u32 pitch;
index 0512fde..7b158fc 100644 (file)
@@ -64,6 +64,7 @@ struct drm_virtgpu_map {
        __u32 pad;
 };
 
+/* fence_fd is modified on success if VIRTGPU_EXECBUF_FENCE_FD_OUT flag is set. */
 struct drm_virtgpu_execbuffer {
        __u32 flags;
        __u32 size;