Skip to content

Commit 274adbf

Browse files
committed
Merge tag 'drm-fixes-2020-01-24' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "This one has a core mst fix and two i915 fixes. amdgpu just enables some hw outside experimental. The panfrost fix is a little bigger than I'd like at this stage but it fixes a fairly fundamental problem with global shared buffers in that driver, and since it's confined to that driver and I've taken a look at it, I think it's fine to get into the tree now, so it can get stable propagated as well. core/mst: - Fix SST branch device handling amdgpu: - enable renoir outside experimental i915: - Avoid overflow with huge userptr objects - uAPI fix to correctly handle negative values in engine->uabi_class/instance (cc: stable) panfrost: - Fix mapping of globally visible BO's (Boris)" * tag 'drm-fixes-2020-01-24' of git://anongit.freedesktop.org/drm/drm: drm/amdgpu: remove the experimental flag for renoir drm/panfrost: Add the panfrost_gem_mapping concept drm/i915: Align engine->uabi_class/instance with i915_drm.h drm/i915/userptr: fix size calculation drm/dp_mst: Handle SST-only branch device case
2 parents ab10ae1 + 49412f6 commit 274adbf

15 files changed

Lines changed: 396 additions & 147 deletions

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ static const struct pci_device_id pciidlist[] = {
10041004
{0x1002, 0x734F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI14},
10051005

10061006
/* Renoir */
1007-
{0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU|AMD_EXP_HW_SUPPORT},
1007+
{0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
10081008

10091009
/* Navi12 */
10101010
{0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT},

drivers/gpu/drm/drm_dp_mst_topology.c

Lines changed: 80 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,73 +1916,90 @@ static u8 drm_dp_calculate_rad(struct drm_dp_mst_port *port,
19161916
return parent_lct + 1;
19171917
}
19181918

1919-
static int drm_dp_port_set_pdt(struct drm_dp_mst_port *port, u8 new_pdt)
1919+
static bool drm_dp_mst_is_dp_mst_end_device(u8 pdt, bool mcs)
1920+
{
1921+
switch (pdt) {
1922+
case DP_PEER_DEVICE_DP_LEGACY_CONV:
1923+
case DP_PEER_DEVICE_SST_SINK:
1924+
return true;
1925+
case DP_PEER_DEVICE_MST_BRANCHING:
1926+
/* For sst branch device */
1927+
if (!mcs)
1928+
return true;
1929+
1930+
return false;
1931+
}
1932+
return true;
1933+
}
1934+
1935+
static int
1936+
drm_dp_port_set_pdt(struct drm_dp_mst_port *port, u8 new_pdt,
1937+
bool new_mcs)
19201938
{
19211939
struct drm_dp_mst_topology_mgr *mgr = port->mgr;
19221940
struct drm_dp_mst_branch *mstb;
19231941
u8 rad[8], lct;
19241942
int ret = 0;
19251943

1926-
if (port->pdt == new_pdt)
1944+
if (port->pdt == new_pdt && port->mcs == new_mcs)
19271945
return 0;
19281946

19291947
/* Teardown the old pdt, if there is one */
1930-
switch (port->pdt) {
1931-
case DP_PEER_DEVICE_DP_LEGACY_CONV:
1932-
case DP_PEER_DEVICE_SST_SINK:
1933-
/*
1934-
* If the new PDT would also have an i2c bus, don't bother
1935-
* with reregistering it
1936-
*/
1937-
if (new_pdt == DP_PEER_DEVICE_DP_LEGACY_CONV ||
1938-
new_pdt == DP_PEER_DEVICE_SST_SINK) {
1939-
port->pdt = new_pdt;
1940-
return 0;
1941-
}
1948+
if (port->pdt != DP_PEER_DEVICE_NONE) {
1949+
if (drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) {
1950+
/*
1951+
* If the new PDT would also have an i2c bus,
1952+
* don't bother with reregistering it
1953+
*/
1954+
if (new_pdt != DP_PEER_DEVICE_NONE &&
1955+
drm_dp_mst_is_dp_mst_end_device(new_pdt, new_mcs)) {
1956+
port->pdt = new_pdt;
1957+
port->mcs = new_mcs;
1958+
return 0;
1959+
}
19421960

1943-
/* remove i2c over sideband */
1944-
drm_dp_mst_unregister_i2c_bus(&port->aux);
1945-
break;
1946-
case DP_PEER_DEVICE_MST_BRANCHING:
1947-
mutex_lock(&mgr->lock);
1948-
drm_dp_mst_topology_put_mstb(port->mstb);
1949-
port->mstb = NULL;
1950-
mutex_unlock(&mgr->lock);
1951-
break;
1961+
/* remove i2c over sideband */
1962+
drm_dp_mst_unregister_i2c_bus(&port->aux);
1963+
} else {
1964+
mutex_lock(&mgr->lock);
1965+
drm_dp_mst_topology_put_mstb(port->mstb);
1966+
port->mstb = NULL;
1967+
mutex_unlock(&mgr->lock);
1968+
}
19521969
}
19531970

19541971
port->pdt = new_pdt;
1955-
switch (port->pdt) {
1956-
case DP_PEER_DEVICE_DP_LEGACY_CONV:
1957-
case DP_PEER_DEVICE_SST_SINK:
1958-
/* add i2c over sideband */
1959-
ret = drm_dp_mst_register_i2c_bus(&port->aux);
1960-
break;
1972+
port->mcs = new_mcs;
19611973

1962-
case DP_PEER_DEVICE_MST_BRANCHING:
1963-
lct = drm_dp_calculate_rad(port, rad);
1964-
mstb = drm_dp_add_mst_branch_device(lct, rad);
1965-
if (!mstb) {
1966-
ret = -ENOMEM;
1967-
DRM_ERROR("Failed to create MSTB for port %p", port);
1968-
goto out;
1969-
}
1974+
if (port->pdt != DP_PEER_DEVICE_NONE) {
1975+
if (drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) {
1976+
/* add i2c over sideband */
1977+
ret = drm_dp_mst_register_i2c_bus(&port->aux);
1978+
} else {
1979+
lct = drm_dp_calculate_rad(port, rad);
1980+
mstb = drm_dp_add_mst_branch_device(lct, rad);
1981+
if (!mstb) {
1982+
ret = -ENOMEM;
1983+
DRM_ERROR("Failed to create MSTB for port %p",
1984+
port);
1985+
goto out;
1986+
}
19701987

1971-
mutex_lock(&mgr->lock);
1972-
port->mstb = mstb;
1973-
mstb->mgr = port->mgr;
1974-
mstb->port_parent = port;
1988+
mutex_lock(&mgr->lock);
1989+
port->mstb = mstb;
1990+
mstb->mgr = port->mgr;
1991+
mstb->port_parent = port;
19751992

1976-
/*
1977-
* Make sure this port's memory allocation stays
1978-
* around until its child MSTB releases it
1979-
*/
1980-
drm_dp_mst_get_port_malloc(port);
1981-
mutex_unlock(&mgr->lock);
1993+
/*
1994+
* Make sure this port's memory allocation stays
1995+
* around until its child MSTB releases it
1996+
*/
1997+
drm_dp_mst_get_port_malloc(port);
1998+
mutex_unlock(&mgr->lock);
19821999

1983-
/* And make sure we send a link address for this */
1984-
ret = 1;
1985-
break;
2000+
/* And make sure we send a link address for this */
2001+
ret = 1;
2002+
}
19862003
}
19872004

19882005
out:
@@ -2135,9 +2152,8 @@ drm_dp_mst_port_add_connector(struct drm_dp_mst_branch *mstb,
21352152
goto error;
21362153
}
21372154

2138-
if ((port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV ||
2139-
port->pdt == DP_PEER_DEVICE_SST_SINK) &&
2140-
port->port_num >= DP_MST_LOGICAL_PORT_0) {
2155+
if (port->pdt != DP_PEER_DEVICE_NONE &&
2156+
drm_dp_mst_is_dp_mst_end_device(port->pdt, port->mcs)) {
21412157
port->cached_edid = drm_get_edid(port->connector,
21422158
&port->aux.ddc);
21432159
drm_connector_set_tile_property(port->connector);
@@ -2201,6 +2217,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
22012217
struct drm_dp_mst_port *port;
22022218
int old_ddps = 0, ret;
22032219
u8 new_pdt = DP_PEER_DEVICE_NONE;
2220+
bool new_mcs = 0;
22042221
bool created = false, send_link_addr = false, changed = false;
22052222

22062223
port = drm_dp_get_port(mstb, port_msg->port_number);
@@ -2245,7 +2262,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
22452262
port->input = port_msg->input_port;
22462263
if (!port->input)
22472264
new_pdt = port_msg->peer_device_type;
2248-
port->mcs = port_msg->mcs;
2265+
new_mcs = port_msg->mcs;
22492266
port->ddps = port_msg->ddps;
22502267
port->ldps = port_msg->legacy_device_plug_status;
22512268
port->dpcd_rev = port_msg->dpcd_revision;
@@ -2272,7 +2289,7 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
22722289
}
22732290
}
22742291

2275-
ret = drm_dp_port_set_pdt(port, new_pdt);
2292+
ret = drm_dp_port_set_pdt(port, new_pdt, new_mcs);
22762293
if (ret == 1) {
22772294
send_link_addr = true;
22782295
} else if (ret < 0) {
@@ -2286,7 +2303,8 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
22862303
* we're coming out of suspend. In this case, always resend the link
22872304
* address if there's an MSTB on this port
22882305
*/
2289-
if (!created && port->pdt == DP_PEER_DEVICE_MST_BRANCHING)
2306+
if (!created && port->pdt == DP_PEER_DEVICE_MST_BRANCHING &&
2307+
port->mcs)
22902308
send_link_addr = true;
22912309

22922310
if (port->connector)
@@ -2323,6 +2341,7 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
23232341
struct drm_dp_mst_port *port;
23242342
int old_ddps, old_input, ret, i;
23252343
u8 new_pdt;
2344+
bool new_mcs;
23262345
bool dowork = false, create_connector = false;
23272346

23282347
port = drm_dp_get_port(mstb, conn_stat->port_number);
@@ -2354,7 +2373,6 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
23542373
old_ddps = port->ddps;
23552374
old_input = port->input;
23562375
port->input = conn_stat->input_port;
2357-
port->mcs = conn_stat->message_capability_status;
23582376
port->ldps = conn_stat->legacy_device_plug_status;
23592377
port->ddps = conn_stat->displayport_device_plug_status;
23602378

@@ -2367,8 +2385,8 @@ drm_dp_mst_handle_conn_stat(struct drm_dp_mst_branch *mstb,
23672385
}
23682386

23692387
new_pdt = port->input ? DP_PEER_DEVICE_NONE : conn_stat->peer_device_type;
2370-
2371-
ret = drm_dp_port_set_pdt(port, new_pdt);
2388+
new_mcs = conn_stat->message_capability_status;
2389+
ret = drm_dp_port_set_pdt(port, new_pdt, new_mcs);
23722390
if (ret == 1) {
23732391
dowork = true;
23742392
} else if (ret < 0) {
@@ -3929,6 +3947,8 @@ drm_dp_mst_detect_port(struct drm_connector *connector,
39293947
switch (port->pdt) {
39303948
case DP_PEER_DEVICE_NONE:
39313949
case DP_PEER_DEVICE_MST_BRANCHING:
3950+
if (!port->mcs)
3951+
ret = connector_status_connected;
39323952
break;
39333953

39343954
case DP_PEER_DEVICE_SST_SINK:
@@ -4541,7 +4561,7 @@ drm_dp_delayed_destroy_port(struct drm_dp_mst_port *port)
45414561
if (port->connector)
45424562
port->mgr->cbs->destroy_connector(port->mgr, port->connector);
45434563

4544-
drm_dp_port_set_pdt(port, DP_PEER_DEVICE_NONE);
4564+
drm_dp_port_set_pdt(port, DP_PEER_DEVICE_NONE, port->mcs);
45454565
drm_dp_mst_put_port_malloc(port);
45464566
}
45474567

drivers/gpu/drm/i915/gem/i915_gem_busy.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
#include "i915_gem_ioctls.h"
1010
#include "i915_gem_object.h"
1111

12-
static __always_inline u32 __busy_read_flag(u8 id)
12+
static __always_inline u32 __busy_read_flag(u16 id)
1313
{
14-
if (id == (u8)I915_ENGINE_CLASS_INVALID)
14+
if (id == (u16)I915_ENGINE_CLASS_INVALID)
1515
return 0xffff0000u;
1616

1717
GEM_BUG_ON(id >= 16);
1818
return 0x10000u << id;
1919
}
2020

21-
static __always_inline u32 __busy_write_id(u8 id)
21+
static __always_inline u32 __busy_write_id(u16 id)
2222
{
2323
/*
2424
* The uABI guarantees an active writer is also amongst the read
@@ -29,14 +29,14 @@ static __always_inline u32 __busy_write_id(u8 id)
2929
* last_read - hence we always set both read and write busy for
3030
* last_write.
3131
*/
32-
if (id == (u8)I915_ENGINE_CLASS_INVALID)
32+
if (id == (u16)I915_ENGINE_CLASS_INVALID)
3333
return 0xffffffffu;
3434

3535
return (id + 1) | __busy_read_flag(id);
3636
}
3737

3838
static __always_inline unsigned int
39-
__busy_set_if_active(const struct dma_fence *fence, u32 (*flag)(u8 id))
39+
__busy_set_if_active(const struct dma_fence *fence, u32 (*flag)(u16 id))
4040
{
4141
const struct i915_request *rq;
4242

@@ -57,7 +57,7 @@ __busy_set_if_active(const struct dma_fence *fence, u32 (*flag)(u8 id))
5757
return 0;
5858

5959
/* Beware type-expansion follies! */
60-
BUILD_BUG_ON(!typecheck(u8, rq->engine->uabi_class));
60+
BUILD_BUG_ON(!typecheck(u16, rq->engine->uabi_class));
6161
return flag(rq->engine->uabi_class);
6262
}
6363

drivers/gpu/drm/i915/gem/i915_gem_userptr.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ struct get_pages_work {
402402

403403
static struct sg_table *
404404
__i915_gem_userptr_alloc_pages(struct drm_i915_gem_object *obj,
405-
struct page **pvec, int num_pages)
405+
struct page **pvec, unsigned long num_pages)
406406
{
407407
unsigned int max_segment = i915_sg_segment_size();
408408
struct sg_table *st;
@@ -448,9 +448,10 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
448448
{
449449
struct get_pages_work *work = container_of(_work, typeof(*work), work);
450450
struct drm_i915_gem_object *obj = work->obj;
451-
const int npages = obj->base.size >> PAGE_SHIFT;
451+
const unsigned long npages = obj->base.size >> PAGE_SHIFT;
452+
unsigned long pinned;
452453
struct page **pvec;
453-
int pinned, ret;
454+
int ret;
454455

455456
ret = -ENOMEM;
456457
pinned = 0;
@@ -553,7 +554,7 @@ __i915_gem_userptr_get_pages_schedule(struct drm_i915_gem_object *obj)
553554

554555
static int i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj)
555556
{
556-
const int num_pages = obj->base.size >> PAGE_SHIFT;
557+
const unsigned long num_pages = obj->base.size >> PAGE_SHIFT;
557558
struct mm_struct *mm = obj->userptr.mm->mm;
558559
struct page **pvec;
559560
struct sg_table *pages;

drivers/gpu/drm/i915/gt/intel_engine_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ struct intel_engine_cs {
274274
u8 class;
275275
u8 instance;
276276

277-
u8 uabi_class;
278-
u8 uabi_instance;
277+
u16 uabi_class;
278+
u16 uabi_instance;
279279

280280
u32 uabi_capabilities;
281281
u32 context_size;

drivers/gpu/drm/i915/i915_gem_gtt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,7 @@ gen8_ppgtt_insert_pte(struct i915_ppgtt *ppgtt,
11771177
pd = i915_pd_entry(pdp, gen8_pd_index(idx, 2));
11781178
vaddr = kmap_atomic_px(i915_pt_entry(pd, gen8_pd_index(idx, 1)));
11791179
do {
1180+
GEM_BUG_ON(iter->sg->length < I915_GTT_PAGE_SIZE);
11801181
vaddr[gen8_pd_index(idx, 0)] = pte_encode | iter->dma;
11811182

11821183
iter->dma += I915_GTT_PAGE_SIZE;
@@ -1660,6 +1661,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm,
16601661

16611662
vaddr = kmap_atomic_px(i915_pt_entry(pd, act_pt));
16621663
do {
1664+
GEM_BUG_ON(iter.sg->length < I915_GTT_PAGE_SIZE);
16631665
vaddr[act_pte] = pte_encode | GEN6_PTE_ADDR_ENCODE(iter.dma);
16641666

16651667
iter.dma += I915_GTT_PAGE_SIZE;

0 commit comments

Comments
 (0)